Ad

Java.lang.NoClassDefFoundError: Failed Resolution

- 1 answer

Please do not mark it as duplicate as I failed to found any resolution to my problem. I'm getting the above error while adding Firebase Firestore dependencies, here is the logcat output:

2019-05-10 09:16:47.765 12401-12401/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.curiosity.gkindia, PID: 12401
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp$IdTokenListenersCountChangedListener;
    at com.google.firebase.auth.zzp.create(Unknown Source:3)
    at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:[email protected]@17.0.0:66)
    at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
    at com.google.firebase.components.Lazy.get(com.google.firebase:[email protected]@17.0.0:53)
    at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:[email protected]@17.0.0:155)
    at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:[email protected]@17.0.0:642)
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:358)
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:321)
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:305)
    at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:[email protected]@17.0.0:53)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2064)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2039)
    at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:[email protected]@17.0.0:47)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6534)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6086)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5998)
    at android.app.ActivityThread.-wrap1(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:192)
    at android.app.ActivityThread.main(ActivityThread.java:6806)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:445)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:867)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.FirebaseApp$IdTokenListenersCountChangedListener" on path: DexPathList[[zip file "/data/app/com.curiosity.gkindia-4Eog6wBBYmYzgRc8QA334g==/base.apk"],nativeLibraryDirectories=[/data/app/com.curiosity.gkindia-4Eog6wBBYmYzgRc8QA334g==/lib/arm64, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at com.google.firebase.auth.zzp.create(Unknown Source:3) 
    at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:[email protected]@17.0.0:66) 
    at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4) 
    at com.google.firebase.components.Lazy.get(com.google.firebase:[email protected]@17.0.0:53) 
    at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:[email protected]@17.0.0:155) 
    at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:[email protected]@17.0.0:642) 
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:358) 
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:321) 
    at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:[email protected]@17.0.0:305) 
    at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:[email protected]@17.0.0:53) 
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2064) 
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2039) 
    at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:[email protected]@17.0.0:47) 
    at android.app.ActivityThread.installProvider(ActivityThread.java:6534) 
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6086) 
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5998) 
    at android.app.ActivityThread.-wrap1(Unknown Source:0) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823) 
    at android.os.Handler.dispatchMessage(Handler.java:106) 
    at android.os.Looper.loop(Looper.java:192) 
    at android.app.ActivityThread.main(ActivityThread.java:6806) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:445) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:867) 

Build.gradle

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
//multidex
implementation 'com.android.support:multidex:1.0.3'
//Firebase dependencies
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-ads:17.2.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0' //<=error

//facebook SDK
implementation 'com.facebook.android:facebook-android-sdk:4.42.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
  core:3.0.2'
  }

Everything is good until I add firestore dependencies, please I'm loosing my precious development time, I already did what I can but seems I'm out of luck this time, please help me.

Ad

Answer

Change your firebase dependecies as below:

//Firebase dependencies
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:2.1.0'
implementation 'com.google.firebase:firebase-ads:17.1.3'
implementation 'com.google.firebase:firebase-firestore:18.1.0'

Below are the links for respective dependencies: You can find all the versions there and can update which suits your needs:

https://mvnrepository.com/artifact/com.google.firebase/firebase-corehttps://mvnrepository.com/artifact/com.google.firebase/firebase-authhttps://mvnrepository.com/artifact/com.firebaseui/firebase-ui-authhttps://mvnrepository.com/artifact/com.google.firebase/firebase-adshttps://mvnrepository.com/artifact/com.google.firebase/firebase-firestore

Ad
source: stackoverflow.com
Ad