web-dev-qa-db-fra.com

java.lang.NoClassDefFoundError: Echec de la résolution Echec de la résolution de: Lcom/google/Android/gms/common/internal/zzab;

Je suis un tutoriel ( link ) pour télécharger des images dans la base de données Firebase, mais je reçois l’erreur ci-dessous. J'ai revérifié les dépendances de gradle et activé le support multidex, mais l'erreur persiste

Java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/Android/gms/common/internal/zzab;
    at com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source)
    at com.paperwrrk.Android.storageref.MainActivity.<init>(MainActivity.Java:36)
    at Java.lang.Class.newInstance(Native Method)
    at Android.app.Instrumentation.newActivity(Instrumentation.Java:1068)
    at Android.app.ActivityThread.performLaunchActivity(ActivityThread.Java:2351)
    at Android.app.ActivityThread.handleLaunchActivity(ActivityThread.Java:2510)
    at Android.app.ActivityThread.-wrap11(ActivityThread.Java)
    at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1363)
    at Android.os.Handler.dispatchMessage(Handler.Java:102)
    at Android.os.Looper.loop(Looper.Java:148)
    at Android.app.ActivityThread.main(ActivityThread.Java:5461)
    at Java.lang.reflect.Method.invoke(Native Method)
    at com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.Java:726)
    at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:616)
    at de.robv.Android.xposed.XposedBridge.main(XposedBridge.Java:102)
    Caused by: Java.lang.ClassNotFoundException: Didn't find class "com.google.Android.gms.common.internal.zzab" on path: DexPathList[[dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-tubesock-0.0.11_74622aa9da17bf60443b34c100000d076f6631ba-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-support-annotations-25.0.0_416ca7aea2b0e15fba678c97c0d71c330758ffee-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-jackson-databind-2.2.2_169f7b55dddecf9b169deccb0ac50ee124eda962-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-jackson-core-2.2.2_3ae6e87b0280ab52f712dfb927e3401fe25aa21c-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-jackson-annotations-2.2.2_dd21f43a23482b41eb5ed094fcce68c90eeb0ffd-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-internal_impl-25.0.0_e8156948d2eb9e5ed0b41cc1f9f830e7838bb3b5-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-internal_impl-25.0.0_9056040795c4cf170b00cbf021bf976514542498-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-internal_impl-25.0.0_79b2045e82b81d2f064515f884990a3d2a9f29af-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-internal_impl-25.0.0_2879b3ac18601405060244958a8db64bdb3655f9-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-internal_impl-25.0.0_1ce40cec84eadc9153f026cb869c8b1760c8461a-classes.dex", dex file "/data/data/com.paperwrrk.Android.storageref/files/instant-run/dex/slice-firebase-client-jvm-2.3.1_764f8006

Gradle.app

apply plugin: 'com.Android.application'

Android {
    compileSdkVersion 25
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.paperwrrk.Android.storageref"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "Android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.Android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.Android.support', module: 'support-annotations'
    })
    compile 'com.Android.support:appcompat-v7:25.0.0'
    compile 'com.google.firebase:firebase-database:10.0.0'
    testCompile 'junit:junit:4.12'
    compile 'com.firebase:firebase-client-Android:2.3.1'
    compile 'com.google.firebase:firebase-auth:9.2.1'
    compile 'com.google.firebase:firebase-storage:9.2.1'
    compile 'com.Android.support:multidex:1.0.0'
}


apply plugin: 'com.google.gms.google-services'

S'il vous plaît dites ce que je fais mal ici!

15
Novo Lucas

maintenant, voici le problème, vous utilisez différentes versions dans les dépendances de gradle

compile 'com.google.firebase:firebase-database:10.0.0'
testCompile 'junit:junit:4.12'
compile 'com.firebase:firebase-client-Android:2.3.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.firebase:firebase-storage:9.2.1'
compile 'com.Android.support:multidex:1.0.0'

pour ça

compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.firebase:firebase-client-Android:2.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.Android.support:multidex:1.0.0'

une autre chose est que com.firebae:firebase-client-Android est maintenant obsolète. Vous devez donc le remplacer par com.google.firebase:firebase-database:10.0.1. Voici la documentation correspondante https://firebase.google.com/support/guides/firebase-Android

25
Umar Ata

Si vous cherchez une solution pour un projet natif de réaction, assurez-vous que la même version est utilisée entre différents modules et remplacez "+" par la dernière version disponible.

1
Faisal Hassan