Search code examples
androidfirebasegoogle-cloud-firestorefirebase-authenticationfirebase-in-app-messaging

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


Getting runtime exception while trying to use Firebase Auth and In-App Messaging. As soon as I try to authenticate user with Firebase getting following exception -

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$3(com.google.firebase:firebase-firestore@@21.4.1:534)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.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$0(com.google.firebase:firebase-firestore@@21.4.1:108)
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda$1.run(com.google.firebase:firebase-firestore@@21.4.1)
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(com.google.firebase:firebase-firestore@@21.4.1:436)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$2.call(com.google.firebase:firebase-firestore@@21.4.1)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(com.google.firebase:firebase-firestore@@21.4.1:322)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda$2.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$0(com.google.firebase:firebase-firestore@@21.4.1:108) 
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda$1.run(com.google.firebase:firebase-firestore@@21.4.1) 
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(com.google.firebase:firebase-firestore@@21.4.1:436) 
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$2.call(com.google.firebase:firebase-firestore@@21.4.1) 
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(com.google.firebase:firebase-firestore@@21.4.1:322) 
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda$2.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

Following dependencies are being used -

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
}

If I remove following dependency from build.gradle file

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

then exception is resolved, but I want to use Firebase In-App Messaging feature in my app. Any help or suggestions are welcome.


Solution

  • java.lang.RuntimeException: Internal error in Cloud Firestore 
    

    Seems like bug for this version. You can raise an issue @Google or @Github for this.

    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.

    You should upgrade your 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'
    

    FYI

    If same issues still coming then You can downgrade your version for now

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