question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Firebase database] Uncaught exception in Firebase Database runloop (19.3.0)

See original GitHub issue

Dear team, I met this issue in my project and have no idea to fix it. Help me please.

My project has implemented firebase data before (11.8.0) and run normally. I recently add firebase crashlytics sdk (database update to 19.3.0) and get crash when running project with release mode (minifyEnable = true).

My gradle file

implementation("com.google.firebase:firebase-core:17.4.1")
implementation("com.google.firebase:firebase-analytics:17.2.3")
implementation("com.google.firebase:firebase-messaging:20.1.7")
implementation("com.google.firebase:firebase-database:19.3.0")
implementation("com.google.firebase:firebase-auth:19.3.1")
implementation("com.google.firebase:firebase-crashlytics:17.0.0")

My code

FirebaseDatabase database = FirebaseDatabase.getInstance();

    DatabaseReference dbRef = database.getReference("/mydbkey");
    dbRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
           // Do my stuff
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            // Do my stuff
        }
    });

The crashed message

Fatal Exception: java.lang.RuntimeException: Uncaught exception in Firebase Database runloop (19.3.0). If you are not already on the latest version of the Firebase SDKs, try updating your dependencies. Should this problem persist, please file a report at https://github.com/firebase/firebase-android-sdk at com.google.firebase.database.android.AndroidPlatform$1$1.run(AndroidPlatform.java:96) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:201) at android.app.ActivityThread.main(ActivityThread.java:6820) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:922) Caused by java.lang.NoSuchMethodError: No virtual method object()Lcom//android/am4; in class Lcom//android/am4; or its super classes (declaration of 'com..android.am4’ appears in /data/app/com..dev-fG3zQ87gx1RUrYnvZ7rj7g==/base.apk!classes3.dex) at com.google.firebase.database.util.JsonMapper.serializeJsonValue(JsonMapper.java:69) at com.google.firebase.database.util.JsonMapper.serializeJsonValue(JsonMapper.java:58) at com.google.firebase.database.util.JsonMapper.serializeJson(JsonMapper.java:38) at com.google.firebase.database.connection.WebsocketConnection.send(WebsocketConnection.java:231) at com.google.firebase.database.connection.Connection.sendData(Connection.java:243) at com.google.firebase.database.connection.Connection.sendRequest(Connection.java:117) at com.google.firebase.database.connection.PersistentConnectionImpl.sendSensitive(PersistentConnectionImpl.java:1177) at com.google.firebase.database.connection.PersistentConnectionImpl.sendAction(PersistentConnectionImpl.java:1164) at com.google.firebase.database.connection.PersistentConnectionImpl.sendStats(PersistentConnectionImpl.java:1116) at com.google.firebase.database.connection.PersistentConnectionImpl.sendConnectStats(PersistentConnectionImpl.java:1159) at com.google.firebase.database.connection.PersistentConnectionImpl.onReady(PersistentConnectionImpl.java:310) at com.google.firebase.database.connection.Connection.onConnectionReady(Connection.java:217) at com.google.firebase.database.connection.Connection.onHandshake(Connection.java:210) at com.google.firebase.database.connection.Connection.onControlMessage(Connection.java:182) at com.google.firebase.database.connection.Connection.onMessage(Connection.java:132) at com.google.firebase.database.connection.WebsocketConnection.appendFrame(WebsocketConnection.java:256) at com.google.firebase.database.connection.WebsocketConnection.handleIncomingFrame(WebsocketConnection.java:303) at com.google.firebase.database.connection.WebsocketConnection.access$000(WebsocketConnection.java:34) at com.google.firebase.database.connection.WebsocketConnection$WSClientTubesock$2.run(WebsocketConnection.java:86) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jpg-developercommented, Oct 7, 2020

I encountered what I believe is the same issue. See https://github.com/firebase/firebase-android-sdk/issues/2050

And found a fix:

In order to avoid this crash, you need to exclude Json library code from shrinking/obfuscation by adding the following line to your proguard rules file:

-keep class org.json.* { *; }

0reactions
imKarthikMurucommented, Oct 14, 2020

Am facing the same problem tried your all solution but no use, Issue remains…any other solution??

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught exception in Firebase Database runloop (19.3.0)
I recently add firebase crashlytics sdk (database update to 19.3.0) and get crash when running project with release mode (minifyEnable = true).
Read more >
Uncaught exception in Firebase Database runloop (3.0.0 ...
Uncaught exception in Firebase Database runloop (3.0.0). Coused by android.database.sqlite.SQLiteException... 1083 views.
Read more >
Connect your App to Firebase | Firebase Realtime Database
Navigate to the Realtime Database section of the Firebase console. You'll be prompted to select an existing Firebase project. · Select a starting...
Read more >
App Stops working while using Firebase
2019-06-06 23:57:25.808 2717-3321/? E/RunLoop: Uncaught exception in Firebase Database runloop (3.0.0). Please report to firebase-database-client@google.com ...
Read more >
How to fix Firestore Error: PERMISSION_DENIED - Medium
Generally, when we interact with Firebase products, and something goes wrong, a FirebaseException will be thrown. When it comes in particular to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found