Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use Firebase in-app messaging in Android?

I'm trying to implement the new Firebase in-app messaging feature to my Android app.but for whatsoever reason the app is crashing the moment I added the library to my gradle.

This is my gradle:

implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'

I gave the poicasso here because in the crash log I'm getting an error related to picasso

Here is the log file:

08-19 18:10:08.482 26606-26606/com.kirtu.simpletexts.texts.debug E/CrashlyticsCore: Failed to execute task.
    java.util.concurrent.TimeoutException
        at java.util.concurrent.FutureTask.get(FutureTask.java:177)
        at com.crashlytics.android.core.CrashlyticsBackgroundWorker.submitAndWait(CrashlyticsBackgroundWorker.java:41)
        at com.crashlytics.android.core.CrashlyticsController.handleUncaughtException(CrashlyticsController.java:320)
        at com.crashlytics.android.core.CrashlyticsController$6.onUncaughtException(CrashlyticsController.java:300)
        at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:42)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
08-19 18:10:08.484 26606-26606/com.kirtu.simpletexts.texts.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.kirtu.simpletexts.texts.debug, PID: 26606
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/picasso/OkHttpDownloader;
        at com.google.firebase.inappmessaging.display.internal.b.b.zzr.get(com.google.firebase:firebase-inappmessaging-display@@17.0.0:2038)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.google.firebase.inappmessaging.display.internal.zzf.get(com.google.firebase:firebase-inappmessaging-display@@17.0.0:1021)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.google.firebase.inappmessaging.display.zzb.get(com.google.firebase:firebase-inappmessaging-display@@17.0.0:1062)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.google.firebase.inappmessaging.display.internal.b.a.zzb.zza(com.google.firebase:firebase-inappmessaging-display@@17.0.0:104)
        at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplayRegistrar.zza(com.google.firebase:firebase-inappmessaging-display@@17.0.0:1058)
        at com.google.firebase.inappmessaging.display.zza.create(com.google.firebase:firebase-inappmessaging-display@@17.0.0)
        at com.google.firebase.components.zzh.zza(com.google.firebase:firebase-common@@16.0.1:29)
        at com.google.firebase.components.zzi.get(com.google.firebase:firebase-common@@16.0.1)
        at com.google.firebase.components.zzh.get(com.google.firebase:firebase-common@@16.0.1:40)
        at com.google.firebase.components.ComponentContainer$$CC.get(com.google.firebase:firebase-common@@16.0.1:15)
        at com.google.firebase.components.zzd.get(com.google.firebase:firebase-common@@16.0.1)
        at com.google.firebase.components.zzd.zza(com.google.firebase:firebase-common@@16.0.1:68)
        at com.google.firebase.FirebaseApp.zze(com.google.firebase:firebase-common@@16.0.1:716)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.0.1:329)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.0.1:295)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@16.0.1:282)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@16.0.1:37)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@16.0.1:31)
        at android.app.ActivityThread.installProvider(ActivityThread.java:5977)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5547)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5486)
        at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
        at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:360)
        at android.app.ActivityThread.handleBindApplication(<Xposed>)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1575)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6243)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.OkHttpDownloader" on path: DexPathList[[zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/base.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.kirtu.simpletexts.texts.debug-2/lib/arm64, /data/app/com.kirtu.simpletexts.texts.debug-2/base.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.kirtu.simpletexts.texts.debug-2/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            ... 38 more
08-19 18:10:08.723 834-12882/? E/linker: readlink("/proc/self/fd/276") failed: Permission denied [fd=276]

Check the line where it says something related to picasso line 12.

Let me know if I need to give anything.

like image 681
Aishik kirtaniya Avatar asked Aug 20 '18 15:08

Aishik kirtaniya


1 Answers

I discovered the solution so far, sorry to answer so late.

In-AppMessaging is programmed with Picasso version 2.5.2, so if you compile it with the latest version it will give you a:

java.lang.NoClassDefFoundError error.

To fix it, you must downgrade Picasso version of your Gradle, or remove it like I did:

//implementation 'com.squareup.picasso:picasso:2.71828'

Since the In-App Messaging library already has Picasso integrated, you don't need to register it in your app's build.gradle.

The other thing you have to do is, since you have the new integration that it is:

Picasso.get()

You will have to change it for the implementation of version 2.5.2 that was:

Picasso.with(context)

I hope this fixes your bug, just like it fixed in my compile.

Edit: To complement the In-App Messaging integration topic, these are the libraries that the library uses:

 +--- com.google.firebase:firebase-inappmessaging:17.0.0
|    |    +--- com.google.android.gms:play-services-clearcut:15.0.1 (*)
|    |    +--- com.google.auto.value:auto-value-annotations:1.6
|    |    +--- com.google.dagger:dagger:2.13 (*)
|    |    +--- com.google.firebase:firebase-common:16.0.1 (*)
|    |    +--- com.google.firebase:firebase-iid:16.0.0 -> 17.0.0 (*)
|    |    +--- com.google.firebase:firebase-measurement-connector:17.0.0 (*)
|    |    +--- com.google.firebase:protolite-well-known-types:16.0.0
|    |    |    \--- com.google.protobuf:protobuf-lite:3.0.1
|    |    +--- io.grpc:grpc-okhttp:1.12.0
|    |    |    +--- io.grpc:grpc-core:[1.12.0] -> 1.12.0
|    |    |    |    +--- io.grpc:grpc-context:1.12.0
|    |    |    |    +--- com.google.code.gson:gson:2.7
|    |    |    |    +--- com.google.guava:guava:20.0
|    |    |    |    +--- com.google.errorprone:error_prone_annotations:2.1.2
|    |    |    |    +--- com.google.code.findbugs:jsr305:3.0.0 -> 3.0.1
|    |    |    |    +--- io.opencensus:opencensus-api:0.11.0
|    |    |    |    \--- io.opencensus:opencensus-contrib-grpc-metrics:0.11.0
|    |    |    |         \--- io.opencensus:opencensus-api:0.11.0
|    |    |    +--- com.squareup.okhttp:okhttp:2.5.0 -> 2.7.5
|    |    |    |    \--- com.squareup.okio:okio:1.6.0 -> 1.14.0
|    |    |    \--- com.squareup.okio:okio:1.13.0 -> 1.14.0
|    |    +--- io.grpc:grpc-protobuf-lite:1.12.0
|    |    |    +--- io.grpc:grpc-core:1.12.0 (*)
|    |    |    +--- com.google.protobuf:protobuf-lite:3.0.1
|    |    |    \--- com.google.guava:guava:20.0
|    |    +--- io.grpc:grpc-stub:1.12.0
|    |    |    \--- io.grpc:grpc-core:1.12.0 (*)
|    |    +--- io.reactivex.rxjava2:rxandroid:2.0.2
|    |    |    \--- io.reactivex.rxjava2:rxjava:2.1.9 -> 2.1.14
|    |    |         \--- org.reactivestreams:reactive-streams:1.0.2
|    |    \--- io.reactivex.rxjava2:rxjava:2.1.14 (*)
|    +--- com.squareup.okhttp:okhttp:2.7.5 (*)
|    \--- com.squareup.picasso:picasso:2.5.2 -> 2.71828 (*)
like image 63
Esteban Avatar answered Nov 09 '22 05:11

Esteban