Background Our application needs to play mp3 files served by our server. What we used to do is just using MediaPlayer to play that URL. However, there are more and more customers complaint about Music playing being cut off quite frequently. So I had to dig into legacy codes to find out the reason. Reproduce From existing codebase, I could tell our app respects MediaPlayer's OnErrorListener and if MediaPlay throw out any Error, app will try to catch them and recover. Unfortunately, we did not receive any exceptions for this part according to our Fabric crashlytics report. Besides that, this bug is not really easy to reproduce. I knew it must be caused by user's network issue. So I tried Charles proxy and using its throttling feature. However it seems like MediaPlayer would have a special connection after connecting and Charles' throttling can not control that connection. Then I also tried Android Emulator's build-in network status simulation feature. Sti...
I really like to use Jackson library to parse json string. Just now met a problem org.codehaus.jackson.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value The reason is my string contains some newline symbols. Then actually the string is not "valid" or "formatted" Json . Finally I found one quick solution . try { JSONObject b = new JSONObject ( decodedPayload ); decodedPayload = b . toString (); } catch ( JSONException e ) { e . printStackTrace (); } That JSONObject can formatted that unformatted json string . Might be there are some other better solution.
When we tried to migrate our Gitlab from Http to Https , we met a problem of Maven Central which was also maintained as a Git repo. peer not authenticated Basically the reason is JVM can not pick up trusted CA from local machine. So we manually trusted it with commands. 1. Get the certificate file (.cer). I am using Mac so I just trusted that certificate through browser and it will be saved in Keychain Access. Then I just export that certificate as .cer file. 2. Copy the .cer file to $JDK_HOME/jre/lib/security folder 3. Run the command keytool - import - alias <alias_of_this_cert> - file < cert_file_name_you_exported . cer > - keystore cacerts - storepass changeit 4. Gradle is able to find dependencies now. NOTE : how to get current JAVA_HOME: /usr/libexec/java_home [-v '1.8'] how to transfer file through ssh: cat {origin file} | ssh {username}@{remote host} "cat - > {target file}"
Comments
Post a Comment