Firebase Runloop(3.0.0)中未捕获的异常在我的生产Android应用程序中.请报告至support@firebase.com [英] Uncaught exception in Firebase runloop (3.0.0) In my production Android app. Please report to support@firebase.com
问题描述
我知道StackOverflow中已经有很多问题.但是我没有发现这些问题可以解决我的问题.
I know there are already many issues in StackOverflow. But I didn't found any of these fixed my issue.
我的Android应用正在生产中,几乎每天我都会从用户那里收到此错误.
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.
我的build.gradle:
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'
注意:我没有使用Firebase崩溃报告,因为它正在创建不同的进程,这也可能是导致此缺陷的原因.但是不知道为什么我仍然会遇到这个缺陷.
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.
这是我的应用程序链接: 2048实时
Here is my app link: 2048 Live
推荐答案
如果您使用的是事务处理方法,则如果用户在上次事务处理之前的很短时间内反复点击按钮(创建多个事务处理请求),则会发生错误完成.
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 :)
这篇关于Firebase Runloop(3.0.0)中未捕获的异常在我的生产Android应用程序中.请报告至support@firebase.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!