2

I'm getting this error when running our app with Marketing Cloud SDK 5.3.+ with Google Play Services 11.8.0:

java.lang.NoSuchMethodError: No static method getNoBackupFilesDir

Full stack trace:

java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:309)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
 Caused by: java.lang.NoSuchMethodError: No static method getNoBackupFilesDir(Landroid/content/Context;)Ljava/io/File; in class Lcom/google/android/gms/common/util/zzu; or its super classes (declaration of 'com.google.android.gms.common.util.zzu' appears in /data/app/com.eduk.edukandroidapp-2/split_lib_dependencies_apk.apk)
    at com.google.android.gms.iid.zzh.<init>(Unknown Source)
    at com.google.android.gms.iid.zzh.<init>(Unknown Source)
    at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
    at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
    at com.salesforce.marketingcloud.MCJobIntentService.d(Unknown Source)
    at com.salesforce.marketingcloud.MCJobIntentService.onHandleWork(Unknown Source)
    at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:391)
    at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:382)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
    at java.lang.Thread.run(Thread.java:818) 

Using Google Play Services 11.0.1 it works fine, but I need some changes released on 11.4.0 and would prefer use the latest due to bug-fixes. What should I do to solve this?

EDIT: the same happens with Marketing Cloud SDK 5.4.4. :(

EDIT2: I've tried to exclude the Play Services dependency on Salesforce's SDK and force it on the gradle file to 11.8.0, like this:

compile ("com.salesforce.marketingcloud:marketingcloudsdk:5.4.4") {
    exclude module: "android-beacon-library"
    exclude module: "play-services-location"
    exclude group: "com.google.android.gms", module: "play-services-gcm"
}

But then I got this error:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/iid/InstanceID;
    at com.salesforce.marketingcloud.i.c(Unknown Source)
    at com.salesforce.marketingcloud.i.a(Unknown Source)
    at com.salesforce.marketingcloud.MCService.onHandleIntent(Unknown Source)
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.os.HandlerThread.run(HandlerThread.java:61)
  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.iid.InstanceID" on path: DexPathList[[zip file "/data/app/com.eduk.edukandroidapp-1/base.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.eduk.edukandroidapp-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.eduk.edukandroidapp-1/lib/arm, /data/app/com.eduk.edukandroidapp-1/base.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_8_apk.apk!/lib/armeabi-v7a, /data/app/com.eduk.edukandroidapp-1/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    at com.salesforce.marketingcloud.i.c(Unknown Source) 
    at com.salesforce.marketingcloud.i.a(Unknown Source) 
    at com.salesforce.marketingcloud.MCService.onHandleIntent(Unknown Source) 
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.os.HandlerThread.run(HandlerThread.java:61) 
    Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.iid.InstanceID
    at java.lang.Class.classForName(Native Method)
    at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
    at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
    ... 8 more
  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

EDIT3: I've made a separate, public, code that shows the error and hosted it on GitHub: https://github.com/danielgimenes/ExactTargetTestDrive

  • Have you tried excluding the play services libraries from the SDK's dependency declaration and including them manually yourself? Also, what API are you targeting? – Bill Mote Mar 15 '18 at 13:36
  • Hi @BillMote, I've tried to exclude the play services dependency on Salesforce SDK and force 11.8.0 as described in "EDIT2" on the post. Unfortunately the same error occurred. We are targeting API 27 and supporting API 15+. – dgimenes Mar 15 '18 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.