gpt4 book ai didi

android - 尝试更新文档时 Firestore (0.6.6-dev) 出现内部错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:36:39 25 4
gpt4 key购买 nike

下面的错误让我很为难。我正在尝试更新存储在我的 Firestore 项目中的文档中的单个字段。

    E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.android.gms.internal.zzejs.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5365)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Cannot perform this operation because there is no current transaction.
at android.database.sqlite.SQLiteSession.throwIfNoTransaction(SQLiteSession.java:926)
at android.database.sqlite.SQLiteSession.endTransaction(SQLiteSession.java:398)
at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:524)
at com.google.android.gms.internal.zzefi.zzb(Unknown Source)
at com.google.android.gms.internal.zzedu.zzcao(Unknown Source)
at com.google.android.gms.internal.zzedu.start(Unknown Source)
at com.google.android.gms.internal.zzeca.zza(Unknown Source)
at com.google.android.gms.internal.zzecc.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at com.google.android.gms.internal.zzejp$zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)

这是我的代码:

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

if(user == null){
Log.e(LOGTAG, "Could not upload because user is not logged in.");
return;
}

FirebaseFirestore db = FirebaseFirestore.getInstance();
DocumentReference userRef = db.collection("users").document(user.getUid());

TextInputEditText textview = findViewById(R.id.edit_text_foo);
String enteredText = textview.getText().toString(); //implements CharSequence, thus toString() gives the correct string
userRef.update("field_foo", enteredText)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.i(LOGTAG, "Text successfully updated!");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, "Error updating text", e);
}
});

每次执行该方法时都会出现错误。恕我直言,“内部错误”短语可能表明这确实是 Firestore 数据库的早期测试状态带来的问题。但是,这是我的第一个 android 应用程序,我也是 Firebase 的新手。任何合格的估值、任何解决方案的想法或任何指示?

最佳答案

感谢@hatboysam,它现在可以使用了。解决方案尽可能简单:

清除设备上应用程序管理器中的数据。

然后再次运行该应用。

关于android - 尝试更新文档时 Firestore (0.6.6-dev) 出现内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46676480/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com