Firebase 应用内消息传递原因 java.lang.RuntimeException:Cloud Firestore (21.4.1) 中的内部错误

Firebase In-App Messaging cause java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.1)

尝试使用 Firebase 身份验证和应用内消息传递时出现运行时异常。一旦我尝试使用 Firebase 对用户进行身份验证,就会出现以下异常 -

I/FIAM.Headless: Starting InAppMessaging runtime with Installation ID dT********Gl49TUSZRKMx

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: buzz.anusmarak, PID: 24274
    java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.1).
        at com.google.firebase.firestore.util.AsyncQueue.lambda$panic(com.google.firebase:firebase-firestore@@21.4.1:534)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda.run(com.google.firebase:firebase-firestore@@21.4.1)
        at android.os.Handler.handleCallback(Handler.java:754)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:163)
        at android.app.ActivityThread.main(ActivityThread.java:6361)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
     Caused by: java.lang.ExceptionInInitializerError
        at com.google.firestore.v1.ListenRequest.getDefaultInstance(com.google.firebase:firebase-firestore@@21.4.1:915)
        at com.google.firestore.v1.FirestoreGrpc.getListenMethod(com.google.firebase:firebase-firestore@@21.4.1:408)
        at com.google.firebase.firestore.remote.WatchStream.<init>(com.google.firebase:firebase-firestore@@21.4.1:61)
        at com.google.firebase.firestore.remote.Datastore.createWatchStream(com.google.firebase:firebase-firestore@@21.4.1:115)
        at com.google.firebase.firestore.remote.RemoteStore.<init>(com.google.firebase:firebase-firestore@@21.4.1:167)
        at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore@@21.4.1:280)
        at com.google.firebase.firestore.core.FirestoreClient.lambda$new[=11=](com.google.firebase:firebase-firestore@@21.4.1:108)
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda.run(com.google.firebase:firebase-firestore@@21.4.1)
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue(com.google.firebase:firebase-firestore@@21.4.1:436)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda.call(com.google.firebase:firebase-firestore@@21.4.1)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult(com.google.firebase:firebase-firestore@@21.4.1:322)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda.run(com.google.firebase:firebase-firestore@@21.4.1)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.4.1:229)
        at java.lang.Thread.run(Thread.java:760)
     Caused by: java.lang.RuntimeException: Unable to get message info for com.google.firestore.v1.ListenRequest
        at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:62)
        at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143)
        at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55)
        at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
        at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
        at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:171)
        at com.google.firestore.v1.ListenRequest.<clinit>(com.google.firebase:firebase-firestore@@21.4.1:911)
        at com.google.firestore.v1.ListenRequest.getDefaultInstance(com.google.firebase:firebase-firestore@@21.4.1:915) 
        at com.google.firestore.v1.FirestoreGrpc.getListenMethod(com.google.firebase:firebase-firestore@@21.4.1:408) 
        at com.google.firebase.firestore.remote.WatchStream.<init>(com.google.firebase:firebase-firestore@@21.4.1:61) 
        at com.google.firebase.firestore.remote.Datastore.createWatchStream(com.google.firebase:firebase-firestore@@21.4.1:115) 
        at com.google.firebase.firestore.remote.RemoteStore.<init>(com.google.firebase:firebase-firestore@@21.4.1:167) 
        at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore@@21.4.1:280) 
        at com.google.firebase.firestore.core.FirestoreClient.lambda$new[=11=](com.google.firebase:firebase-firestore@@21.4.1:108) 
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda.run(com.google.firebase:firebase-firestore@@21.4.1) 
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue(com.google.firebase:firebase-firestore@@21.4.1:436) 
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda.call(com.google.firebase:firebase-firestore@@21.4.1) 
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult(com.google.firebase:firebase-firestore@@21.4.1:322) 
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda.run(com.google.firebase:firebase-firestore@@21.4.1) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.4.1:229) 
        at java.lang.Thread.run(Thread.java:760) 
     Caused by: java.lang.UnsupportedOperationException
        at com.google.firestore.v1.ListenRequest.dynamicMethod(com.google.firebase:firebase-firestore@@21.4.1:903)
        at com.google.protobuf.GeneratedMessageLite.dynamicMethod(GeneratedMessageLite.java:252)
        at com.google.protobuf.GeneratedMessageLite.buildMessageInfo(GeneratedMessageLite.java:280)
E/AndroidRuntime:     at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:60)
            ... 25 more

正在使用以下依赖项 -

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    implementation 'androidx.navigation:navigation-fragment:2.3.0'
    implementation 'androidx.navigation:navigation-ui:2.3.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'

    //firebase Analytics
    implementation 'com.google.firebase:firebase-analytics:17.5.0'
    // FirebaseUI for Cloud Firestore
    implementation 'com.firebaseui:firebase-ui-firestore:6.2.1'
    // FirebaseUI for Firebase Auth
    implementation 'com.firebaseui:firebase-ui-auth:6.2.1'
    //Firebase Storage
    implementation 'com.google.firebase:firebase-storage:19.2.0'
    //Firebase Cloud Messaging
    implementation 'com.google.firebase:firebase-messaging:20.3.0'
    //Firebase In-App Messaging
    implementation 'com.google.firebase:firebase-inappmessaging-display:19.1.1'
    implementation 'com.google.firebase:firebase-inappmessaging:19.1.1'

    //AdsMob
    implementation 'com.google.android.gms:play-services-ads:19.4.0'

    //Preferences Screen
    implementation 'androidx.preference:preference:1.1.1'

    //Kotlin extension
    implementation 'androidx.core:core-ktx:1.3.1'

    //circular images
    implementation 'com.mikhaellopez:circularimageview:4.2.0'

    //lottie animation
    implementation 'com.airbnb.android:lottie:3.4.1'

    // Room components
    implementation "androidx.room:room-runtime:2.2.5"
    annotationProcessor "androidx.room:room-compiler:2.2.5"
    androidTestImplementation "androidx.room:room-testing:2.2.5"

    //Joda Time
    implementation 'net.danlew:android.joda:2.10.6'

    //Image Cropper
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'

    //Calendar View
    implementation 'com.applandeo:material-calendar-view:1.7.0'

    //Work Manager
    implementation "androidx.work:work-runtime:2.4.0"

    //Guava error
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

    //Custom Preference Library
    implementation 'com.takisoft.preferencex:preferencex:1.1.0'
    implementation 'com.takisoft.preferencex:preferencex-datetimepicker:1.1.0'
    implementation 'com.takisoft.preferencex:preferencex-colorpicker:1.1.0'
    //https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#timepickerpreference

    //Color Picker
    implementation 'com.github.rtugeek:colorseekbar:1.7.7'
    //https://github.com/rtugeek/ColorSeekBar
}

如果我从 build.gradle 文件中删除以下依赖项

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

异常已解决,但我想在我的应用中使用 Firebase 应用内消息传递功能。欢迎任何帮助或建议。

java.lang.RuntimeException: Internal error in Cloud Firestore 

似乎是这个版本的错误。您可以为此提出问题@Google or @Github

The Android Issue Tracker contains a list of pending technical tasks across a variety of topics, information relevant to those tasks, and information about progress on those tasks, including which ones might get worked on in the short term.

您应该升级 FirebaseUI for Android version. FirebaseUI for Android v6.3.0 is a minor release containing new features and bug fixes. Read v6.3.0

   implementation 'com.firebaseui:firebase-ui-firestore:6.3.0'
   implementation 'com.firebaseui:firebase-ui-auth:6.3.0'

仅供参考

如果仍然出现同样的问题,那么您可以暂时降级您的版本

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