【发布时间】:2018-07-22 18:24:52
【问题描述】:
我正在尝试从 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
【问题讨论】:
标签: android firebase google-cloud-firestore