Uncaught exception in Firebase runloop (3.0.0) In my production Android app. Please report to support@firebase.com

主宰稳场 提交于 2019-12-08 06:36:08

问题


I know there are already many issues in StackOverflow. But I didn't found any of these fixed my issue.

My Android app is in production and I am getting this error almost everyday from my user.

Fatal Exception: java.lang.RuntimeException: Uncaught exception in Firebase runloop (3.0.0). Please report to support@firebase.com
   at com.google.android.gms.internal.zzagf$1$1.run(Unknown Source)
   at android.os.Handler.handleCallback(Handler.java:815)
   at android.os.Handler.dispatchMessage(Handler.java:104)
   at android.os.Looper.loop(Looper.java:194)
   at android.app.ActivityThread.main(ActivityThread.java:5763)
   at java.lang.reflect.Method.invoke(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by java.util.ConcurrentModificationException
   at java.util.HashMap$HashIterator.remove(HashMap.java:805)
   at bvi.l(:com.google.android.gms.DynamiteModulesC:648)
   at bvi.a(:com.google.android.gms.DynamiteModulesC:388)
   at buw.a(:com.google.android.gms.DynamiteModulesC:82)
   at buw.a(:com.google.android.gms.DynamiteModulesC:4199)
   at bvz.b(:com.google.android.gms.DynamiteModulesC:226)
   at bvz.a(:com.google.android.gms.DynamiteModulesC:271)
   at bwg.run(:com.google.android.gms.DynamiteModulesC:1020)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
   at java.util.concurrent.FutureTask.run(FutureTask.java:237)
   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
   at java.lang.Thread.run(Thread.java:818)

This issue is really annoying and it might also cause me loosing users.

My build.gradle:

compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.firebase:firebase-invites:9.2.1'
compile 'com.firebaseui:firebase-ui-database:0.4.0'

NOTE: I am not using Firebase Crash Reporting, since it is creating a different Process which also can be the cause of this defect. But dont know why I still get this defect.

I have already asked the slack community about this. Seems like they are not able to help me because the code is obfuscated.

Here is my app link: 2048 Live


回答1:


If you're using transaction method, the error occurs if the user taps the button repeatedly (creating multiple transaction requests) and in a short time before the previous transaction finished.

I had the same problem and my solution in my app is by avoiding transaction method if the operation can be done in a short time.

Or you can disable the button and enable it when the previous transaction is finished or prevent the user from abusing the button.

private void onLikeButtonClicked() {
    likeButton.setEnabled(false);
    ref.runTransaction(new Transaction.Handler() {
        @Override
        public Transaction.Result doTransaction(MutableData mutableData) {
            // transaction operation 
            return Transaction.success(mutableData);
        }

        @Override
        public void onComplete(DatabaseError databaseError, boolean b,
                               DataSnapshot dataSnapshot) {
            likeButton.setEnabled(true);
        }
    });
}

I hope you understand my explanation, hope this helps :)




回答2:


This happens when you enable persistent storage. And it seems they are yet to fix it. But if you disable persistent storage, you wont see this issue again.

//FirebaseDatabase.getInstance().setPersistenceEnabled(true);

Comment out this line and it will work. It happen as a result of corrupt database stored locally.



来源:https://stackoverflow.com/questions/39001906/uncaught-exception-in-firebase-runloop-3-0-0-in-my-production-android-app-ple

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!