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

时间:2018-08-20 15:01:03

标签: android firebase picasso okhttp firebase-in-app-messaging

我正在尝试将新的Firebase应用内消息传递功能实现到我的Android应用程序中,但是由于任何原因,当我将库添加到gradle时,该应用程序崩溃。

这是我的礼物:

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

我在这里给出了poicasso的信息,因为在崩溃日志中我收到了与毕加索有关的错误

这是日志文件:

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]

检查与毕加索第12行有关的行。

让我知道是否需要提供任何东西。

1 个答案:

答案 0 :(得分:11)

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

In-AppMessaging使用Picasso 2.5.2版进行编程,因此,如果使用最新版本进行编译,它将为您提供:

java.lang.NoClassDefFoundError error.

要修复此问题,您必须降级Gradle的Picasso版本,或像我一样将其删除:

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

由于应用内消息传递库已经集成了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 (*)