Android 2.2: Parse NoSuchMethodError java.lang.String.getbytes

424 Views Asked by At

Using Android 2.2 and Parse 1.8.0 with compile 'com.parse.bolts:bolts-android:1.+' I get this at start of app with Android 2.2 emulator (Nexus S)

java.lang.NoSuchMethodError: java.lang.String.getBytes
        at com.parse.Parse.saveDiskObject(Parse.java:998)
        at com.parse.Parse.saveDiskObject(Parse.java:1088)
        at com.parse.PushRouter.saveStateToDisk(PushRouter.java:694)
        at com.parse.PushRouter.subscribe(PushRouter.java:747)
        at com.parse.PushRouter$1.then(PushRouter.java:77)
        at com.parse.PushRouter$1.then(PushRouter.java:74)
        at bolts.Task$9.run(Task.java:453)
        at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
        at bolts.Task.completeImmediately(Task.java:449)
        at bolts.Task.continueWith(Task.java:323)
        at bolts.Task.continueWith(Task.java:334)
        at bolts.Task$7.then(Task.java:386)
        at bolts.Task$7.then(Task.java:378)
        at bolts.Task$10.run(Task.java:486)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
        at java.lang.Thread.run(Thread.java:1096)

What is causing this? I tried changing ParseInstallation.getCurrentInstallation().saveEventually(); to ParseInstallation.getCurrentInstallation().saveInBackground(); but no difference.

1

There are 1 best solutions below

0
vap78 On BEST ANSWER

Looks like the parse framework (the com.parse.Parse.saveDiscObject method) uses the java.lang.String.getBytes(Charset) which is available since API level 9 (see http://developer.android.com/reference/java/lang/String.html#getBytes%28java.nio.charset.Charset%29)

Android 2.2 is API level 8.

This at least explains it. I'm not sure how this can be resolved. Perhaps downgrade to earlier version of Parse if possible.