Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;

Tags:

java

android

dex

I got this error when we run apk file of our application. In build.gradle we set multidex and compile multidex is existed in Gradle file . We changed the version of Firebase versions to above and below but that's did not work for us . This is our full log in Run console :

D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: ir.parsinteam.ojoobe, PID: 5141
                  java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
                      at com.google.android.gms.location.LocationServices.<clinit>(Unknown Source)
                      at ir.adad.client.LocationMethods.callAndroidLocationService(LocationMethods.java:101)
                      at ir.adad.client.LocationMethods.<init>(LocationMethods.java:40)
                      at ir.adad.client.LocationMethods.getInstance(LocationMethods.java:45)
                      at ir.adad.client.AdadScript.urlParameters(AdadScript.java:390)
                      at ir.adad.client.AdadScript.downloadClient(AdadScript.java:148)
                      at ir.adad.client.AdadScript.initializeInternal(AdadScript.java:134)
                      at ir.adad.client.AdadScript.initializeClient(AdadScript.java:110)
                      at ir.adad.client.Adad.initialize(Adad.java:22)
                      at ir.parsinteam.ojoobe.activities.MainActivity.onCreate(MainActivity.java:62)
                      at android.app.Activity.performCreate(Activity.java:6662)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                      at android.app.ActivityThread.-wrap12(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6077)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
                   Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/ir.parsinteam.ojoobe-2/base.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_dependencies_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_0_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_1_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_2_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_3_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_4_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_5_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_6_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_7_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_8_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/ir.parsinteam.ojoobe-2/lib/x86, /data/app/ir.parsinteam.ojoobe-2/base.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_dependencies_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_0_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_1_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_2_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_3_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_4_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_5_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_6_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_7_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_8_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
                      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                      at com.google.android.gms.location.LocationServices.<clinit>(Unknown Source) 
                      at ir.adad.client.LocationMethods.callAndroidLocationService(LocationMethods.java:101) 
                      at ir.adad.client.LocationMethods.<init>(LocationMethods.java:40) 
                      at ir.adad.client.LocationMethods.getInstance(LocationMethods.java:45) 
                      at ir.adad.client.AdadScript.urlParameters(AdadScript.java:390) 
                      at ir.adad.client.AdadScript.downloadClient(AdadScript.java:148) 
                      at ir.adad.client.AdadScript.initializeInternal(AdadScript.java:134) 
                      at ir.adad.client.AdadScript.initializeClient(AdadScript.java:110) 
                      at ir.adad.client.Adad.initialize(Adad.java:22) 
                      at ir.parsinteam.ojoobe.activities.MainActivity.onCreate(MainActivity.java:62) 
                      at android.app.Activity.performCreate(Activity.java:6662) 
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
                      at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:154) 
                      at android.app.ActivityThread.main(ActivityThread.java:6077) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
Application terminated.
like image 953
Aly Avatar asked Jul 17 '18 18:07

Aly


3 Answers

In your build.gradle, upgrade play-services-gcm and play-services-location to 15.0.1:

com.google.android.gms:play-services-gcm:15.0.1
com.google.android.gms:play-services-location:15.0.1
like image 60
Brad Pitcher Avatar answered Nov 02 '22 03:11

Brad Pitcher


This is happen when we try to authenticate user with some authenticate service like AccountKit FirebaseAuth and those service depends on play-services-auth So, Add

implementation 'com.google.android.gms:play-services-auth:16.0.0'

on your build.gradle dependencies

like image 14
Md Tanbir Hossen Avatar answered Nov 02 '22 02:11

Md Tanbir Hossen


I fixed this issue. Please follow below code. Added following to android/build.gradle

allprojects {
    repositories {
    //start here
    configurations.all {
 resolutionStrategy.eachDependency { DependencyResolveDetails details ->
   def requested = details.requested
       if (requested.group == 'com.google.android.gms') {
          details.useVersion '12.0.1'
       }
       if (requested.group == 'com.google.firebase') {
          details.useVersion '12.0.1'
         }
       }
     }
    //end
     jcenter()
       maven {
         url "https://maven.google.com"
       }
     }
 }
like image 6
Harika Avatar answered Nov 02 '22 02:11

Harika