web-dev-qa-db-fra.com

Échec de la résolution de: Lcom / google / Android / gms / common / api / Api $ zzf;

J'ai eu cette erreur lorsque nous exécutons le fichier apk de notre application. Dans build.gradle nous mettons multidex et compilons multidex existe dans le fichier Gradle. Nous avons changé la version des versions de Firebase en haut et en bas, mais cela n'a pas fonctionné pour nous. Voici notre connexion complète à la console Run:

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.
8
Mister X

Dans votre build.gradle, mettez à niveau play-services-gcm et play-services-location vers 15.0.1:

com.google.Android.gms:play-services-gcm:15.0.1
com.google.Android.gms:play-services-location:15.0.1
14
Brad Pitcher

Cela se produit lorsque nous essayons d'authentifier l'utilisateur avec un service d'authentification tel que AccountKitFirebaseAuth et que ce service dépend de play-services-auth Alors, ajoutez

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

sur vos dépendances build.gradle

10
Md Tanbir Hossen

J'ai résolu ce problème. Veuillez suivre le code ci-dessous. Ajouté à 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"
       }
     }
 }
6
Harika

Eh bien, j'utilise Account Kit de Facebook. Après avoir ajouté play-services-auth le problème est résolu.

implementation 'com.facebook.Android:account-kit-sdk:4.39.0'

implementation 'com.google.Android.gms:play-services-auth:17.0.0'
2
Shihab Uddin

J'utilisais un package natif React

react-native-facebook-account-kit

résolu en ajoutant

implementation 'com.google.Android.gms:play-services-auth:16.0.1'
0
RodneyO