我正在尝试从Firestore获取集合。出现以下错误。
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.firebase.firestore.g.zza.zzb(SourceFile:324)
at com.google.firebase.firestore.g.zzd.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5834)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.AssertionError: INTERNAL ASSERTION FAILED: Only one thread may be created in an AsyncQueue.
at com.google.a.a.a.a.zza.zza(SourceFile:2032)
at com.google.a.a.a.a.zza.zza(SourceFile:2017)
at com.google.firebase.firestore.g.zza$zza.newThread(SourceFile:195)
at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:582)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:988)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.google.firebase.firestore.g.zza$zza.run(SourceFile:191)
at java.lang.Thread.run(Thread.java:820)
和代码
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
mAuth.signInWithEmailAndPassword("username","password").addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
FirebaseFirestore db = FirebaseFirestore.getInstance();
db.collection("mycollection").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
}
});
}
});
firebase身份验证工作正常,但当我尝试如下所示收集集合时,代码崩溃。有时代码工作正常,并且onComplete被称为
db.collection("mycollection").get().addOnCompleteListener
答案 0 :(得分:1)
首先,尝试清除设备上应用程序管理器中的数据,然后再次运行该应用程序。如果无法通过这种方式工作,请尝试将以下代码行添加到progauard规则中:
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}