[Android] NoClassDefFoundError: com.google.android.gms.common.internal.zzac
by Riley MacDonald, August 6, 2018
Problem
While upgrading my Intoxication Calculator Android Application to meet the new minimum targetSdkVersion
requirements set by Google I ran into a NoClassDefFoundException
when upgrading one of my dependencies.
08-05 16:33:00.872 9004-9004/com.silencecm.IntoxicationCalculator E/AndroidRuntime: FATAL EXCEPTION: main Process: com.silencecm.IntoxicationCalculator, PID: 9004 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzac; at com.google.android.gms.internal.zzrw.zzW(Unknown Source) at com.google.android.gms.analytics.GoogleAnalytics.getInstance(Unknown Source) at com.silencecm.IntoxicationCalculator.ICApplication.getDefaultTracker(ICApplication.java:38) at com.silencecm.IntoxicationCalculator.activities.IntoxicationCalculatorMainActivity.onCreate(IntoxicationCalculatorMainActivity.java:114) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.ClassNotFoundException: Didnt find class "com.google.android.gms.common.internal.zzac" on path: DexPathList[[zip file "/data/app/com.silencecm.IntoxicationCalculator-1/base.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.silencecm.IntoxicationCalculator-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.silencecm.IntoxicationCalculator-1/lib/arm, /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.google.android.gms.internal.zzrw.zzW(Unknown Source) at com.google.android.gms.analytics.GoogleAnalytics.getInstance(Unknown Source) at com.silencecm.IntoxicationCalculator.ICApplication.getDefaultTracker(ICApplication.java:38) at com.silencecm.IntoxicationCalculator.activities.IntoxicationCalculatorMainActivity.onCreate(IntoxicationCalculatorMainActivity.java:114) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.internal.zzac 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) ... 17 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available |
When bumping implementation 'com.google.firebase:firebase-ads'
from 10.0.1
to 15.0.1
the issue was introduced. I assumed this was due to proguard detecting the class as unused and stripping it but this was not the case.
Solution
If you’re application depends on play-services-analytics
and firebase-ads
you must ensure the versions of com.google.android.gms:play-services-analytics
and com.google.firebase:firebase-ads
match in order to resolve this issue. Posting since I was unable to find this solution using search.