Firestore中的内部错误

时间:2018-07-06 03:06:55

标签: android firebase google-cloud-firestore

您好可以帮助我解决此问题。我在Android 17版本上遇到了这个问题

  

Exception java.lang.RuntimeException:Firestore(0.6.6-dev)中的内部错误。

com.google.firebase.firestore.g.zza.zzb (SourceFile:324)
com.google.firebase.firestore.g.zzd.run ()
android.os.Handler.handleCallback (Handler.java:800)
android.os.Handler.dispatchMessage (Handler.java:100)
android.os.Looper.loop (Looper.java:194)
android.app.ActivityThread.main (ActivityThread.java:5469)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:525)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:857)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:624)
dalvik.system.NativeStart.main (NativeStart.java)
  

由java.lang.AssertionError引起:内部声明失败:在AsyncQueue中只能创建一个线程。

com.google.a.a.a.a.zza.zza (SourceFile:2032)
com.google.a.a.a.a.zza.zza (SourceFile:2017)
com.google.firebase.firestore.g.zza$zza.newThread (SourceFile:195)
java.util.concurrent.ThreadPoolExecutor$Worker.<init> (ThreadPoolExecutor.java:568)
java.util.concurrent.ThreadPoolExecutor.addWorker (ThreadPoolExecutor.java:883)
java.util.concurrent.ThreadPoolExecutor.processWorkerExit (ThreadPoolExecutor.java:962)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1098)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:573)
com.google.firebase.firestore.g.zza$zza.run (SourceFile:190)
java.lang.Thread.run (Thread.java:838)

这一个代码

Map<String, Object> users = new HashMap<>();
users.put("username", userName);
users.put("email", userEmail);
users.put("idUser", idUser);

db.collection("users")
.whereEqualTo("id", idUser)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
    @Override
    public void onComplete(@NonNull Task<QuerySnapshot> task) {
        if (task.isSuccessful()) {
            for (QueryDocumentSnapshot document : task.getResult()) {
                    db.collection("users").document(document.getId())
                            .update(users)
                            .addOnSuccessListener(new OnSuccessListener<Void>() {
                                @Override
                                public void onSuccess(Void aVoid) {
                                    Log.d("DocumentReference", "DocumentSnapshot successfully updated!");
                                }
                            })
                            .addOnFailureListener(new OnFailureListener() {
                                @Override
                                public void onFailure(@NonNull Exception e) {
                                    Log.w("DocumentReference", "Error updating document", e);
                                }
                            });
                }
        } else {
            Log.d("DocumentReference", "Error getting documents: ", task.getException());
        }
    }
});

0 个答案:

没有答案