无法在 Android 中使用 Firebase 应用内消息传递?

Unable to use Firebase in-app messaging in Android?

我正在尝试为我的 Android app.but 实现新的 Firebase 应用程序内消息传递功能,无论出于何种原因,当我将库添加到我的 [=27= 时应用程序崩溃了].

这是我的 gradle:

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

我在这里给出了 poicasso,因为在崩溃日志中我收到了与 picasso 相关的错误

这是日志文件:

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.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]

检查与毕加索第 12 行相关内容的行。

如果我需要提供任何东西,请告诉我。

到目前为止我已经找到了解决方案,很抱歉这么晚才回答。

In-AppMessaging 是用 Picasso 2.5.2 版编写的,所以如果你用最新版本编译它,它会给你一个:

java.lang.NoClassDefFoundError error.

要修复它,您必须降级 Gradle 的 Picasso 版本,或者像我一样删除它:

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

由于 In-App Messaging 库已经集成了 Picasso,因此您无需在应用的 build.gradle.

中注册它

您需要做的另一件事是,因为您拥有新的集成:

Picasso.get()

您必须更改它以实现 2.5.2 版:

Picasso.with(context)

我希望这修复了你的错误,就像它在我的编译中修复的那样。

编辑:为了补充应用内消息集成主题,这些是库使用的库:

 +--- 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 (*)