Firebase InApp消息传递在Android 6和5上崩溃

时间:2020-03-06 10:41:16

标签: android firebase noclassdeffounderror firebase-in-app-messaging

仅在Android 6和Android 5上,我的应用程序因出现此错误而崩溃:

io.reactivex.exceptions.UndeliverableException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/base/CharMatcher;
        at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
        at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)
        at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/base/CharMatcher;
        at com.google.common.base.Splitter.on(Splitter.java:125)
        at io.grpc.internal.GrpcUtil.<clinit>(GrpcUtil.java:203)
        at io.grpc.internal.AbstractManagedChannelImplBuilder.<clinit>(AbstractManagedChannelImplBuilder.java:84)
        at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:48)
        at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:27)
        at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:73)
        at com.google.firebase.inappmessaging.internal.injection.modules.GrpcChannelModule.providesGrpcChannel(com.google.firebase:firebase-inappmessaging@@19.0.3:41)
        at com.google.firebase.inappmessaging.internal.injection.modules.GrpcChannelModule_ProvidesGrpcChannelFactory.providesGrpcChannel(com.google.firebase:firebase-inappmessaging@@19.0.3:39)
        at com.google.firebase.inappmessaging.internal.injection.modules.GrpcChannelModule_ProvidesGrpcChannelFactory.get(com.google.firebase:firebase-inappmessaging@@19.0.3:30)
        at com.google.firebase.inappmessaging.internal.injection.modules.GrpcChannelModule_ProvidesGrpcChannelFactory.get(com.google.firebase:firebase-inappmessaging@@19.0.3:9)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.google.firebase.inappmessaging.internal.injection.components.DaggerUniversalComponent.gRPCChannel(com.google.firebase:firebase-inappmessaging@@19.0.3:188)
        at com.google.firebase.inappmessaging.internal.injection.components.DaggerAppComponent$com_google_firebase_inappmessaging_internal_injection_components_UniversalComponent_gRPCChannel.get(com.google.firebase:firebase-inappmessaging@@19.0.3:295)
        at com.google.firebase.inappmessaging.internal.injection.components.DaggerAppComponent$com_google_firebase_inappmessaging_internal_injection_components_UniversalComponent_gRPCChannel.get(com.google.firebase:firebase-inappmessaging@@19.0.3:285)
        at com.google.firebase.inappmessaging.internal.injection.modules.GrpcClientModule_ProvidesInAppMessagingSdkServingStubFactory.get(com.google.firebase:firebase-inappmessaging@@19.0.3:35)
        at com.google.firebase.inappmessaging.internal.injection.modules.GrpcClientModule_ProvidesInAppMessagingSdkServingStubFactory.get(com.google.firebase:firebase-inappmessaging@@19.0.3:11)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.google.firebase.inappmessaging.internal.GrpcClient_Factory.get(com.google.firebase:firebase-inappmessaging@@19.0.3:26)
        at com.google.firebase.inappmessaging.internal.GrpcClient_Factory.get(com.google.firebase:firebase-inappmessaging@@19.0.3:8)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.google.firebase.inappmessaging.internal.ApiClient.getFiams(com.google.firebase:firebase-inappmessaging@@19.0.3:101)
        at com.google.firebase.inappmessaging.internal.InAppMessageStreamManager.lambda$createFirebaseInAppMessageStream$16(com.google.firebase:firebase-inappmessaging@@19.0.3:231)
        at com.google.firebase.inappmessaging.internal.InAppMessageStreamManager$$Lambda$22.call(com.google.firebase:firebase-inappmessaging@@19.0.3)
        at io.reactivex.internal.operators.maybe.M

这是我的gradle设置:

compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {

    ...

    minSdkVersion 21
    targetSdkVersion 28

    ...

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
    multiDexEnabled true

}

我正在使用最新版本的Firebase InApp Messaging

implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.3'

我已经找到了这些问题,但是没有解决方案:

有人有同样的问题吗?

更新

我解决了将Google Guava库添加到gradle中的问题

implementation "com.google.guava:guava:28.2-android"

1 个答案:

答案 0 :(得分:0)

使用以下依赖关系解决此问题

要使用Gradle添加依赖项,请使用以下命令:

implementation "com.google.guava:guava:28.2-android"

有关最新的番石榴库的信息,请参见此documentation