我已经创建了一个简单的UI应用程序来写入Firestore,但OnSuccess或OnFailureListeners似乎没有触发我已经多次尝试重新连接到Firebase,并遵循了一些Stackoverflow线程,但我似乎无法解决我的问题,并且互联网连接没有错误,因为我已经检查了多次......使用Connectivity Manager。验证码:-
private fun updateDatabse(num: String, titleexp: String, gorl: String) {
val user= hashMapOf(
"title" to titleexp,
"expense" to num,
"gorl" to gorl
)
//I have tried to enable network as well but it does not update anydata to to Firestore
// FirebaseFirestore.getInstance().enableNetwork()
val firestore= Firebase.firestore
firestore.collection("users").document(titleexp).set(user)
.addOnSuccessListener {
Toast.makeText(this,"User added",Toast.LENGTH_LONG).show()
}.addOnFailureListener(){
Toast.makeText(this,"Failed!!",Toast.LENGTH_LONG).show()
}
}
字符串
x1c 0d1x的数据
我的安全规则如下:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// This rule allows anyone with your Firestore database reference to view, edit,
// and delete all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// all client requests to your Firestore database will be denied until you Update
// your rules
match /{document=**} {
allow read, write;
}
}
}
型
编辑:- Logcat到现在:-
2023-07-14 21:42:25.431 458-499 FA com...e.budgettrackerusingfirestore D Connected to remote service
2023-07-14 21:42:25.432 458-499 FA com...e.budgettrackerusingfirestore V Processing queued up service tasks: 5
2023-07-14 21:42:28.108 458-458 TextInputLayout com...e.budgettrackerusingfirestore I EditText added is not a TextInputEditText. Please switch to using that class instead.
2023-07-14 21:42:28.121 458-458 TextInputLayout com...e.budgettrackerusingfirestore I EditText added is not a TextInputEditText. Please switch to using that class instead.
2023-07-14 21:42:28.244 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:28.296 458-495 chatty com...e.budgettrackerusingfirestore I uid=10153(com.example.budgettrackerusingfirestore) RenderThread identical 2 lines
2023-07-14 21:42:28.301 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:28.332 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:28.346 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:28.349 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:29.336 458-458 AssistStructure com...e.budgettrackerusingfirestore I Flattened final assist data: 3512 bytes, containing 2 windows, 24 views
2023-07-14 21:42:30.555 458-499 FA com...e.budgettrackerusingfirestore V Inactivity, disconnecting from the service
2023-07-14 21:42:40.286 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:40.294 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:40.311 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:40.330 458-495 chatty com...e.budgettrackerusingfirestore I uid=10153(com.example.budgettrackerusingfirestore) RenderThread identical 2 lines
2023-07-14 21:42:40.344 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:40.360 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:41.220 458-495 chatty com...e.budgettrackerusingfirestore I uid=10153(com.example.budgettrackerusingfirestore) RenderThread identical 2 lines
2023-07-14 21:42:41.284 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:41.285 458-495 OpenGLRenderer com...e.budgettrackerusingfirestore D endAllActiveAnimators on 0xc88bd380 (DropDownListView) with handle 0xc8897060
2023-07-14 21:42:41.297 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:42.192 458-523 DynamiteModule com...e.budgettrackerusingfirestore W Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
2023-07-14 21:42:42.199 458-523 DynamiteModule com...e.budgettrackerusingfirestore I Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
2023-07-14 21:42:42.199 458-523 ProviderInstaller com...e.budgettrackerusingfirestore W Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
2023-07-14 21:42:42.214 458-523 rusingfirestor com...e.budgettrackerusingfirestore I The ClassLoaderContext is a special shared library.
2023-07-14 21:42:42.238 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2023-07-14 21:42:42.238 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.238 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2023-07-14 21:42:42.238 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2023-07-14 21:42:42.241 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.241 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2023-07-14 21:42:42.244 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J (greylist,core-platform-api, linking, allowed)
2023-07-14 21:42:42.245 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2023-07-14 21:42:42.246 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2023-07-14 21:42:42.248 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->peekLong(JZ)J (greylist, reflection, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->pokeLong(JJZ)V (greylist, reflection, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->pokeInt(JIZ)V (greylist, reflection, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->peekInt(JZ)I (greylist, reflection, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->pokeByteArray(J[BII)V (greylist, reflection, allowed)
2023-07-14 21:42:42.253 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Llibcore/io/Memory;->peekByteArray(J[BII)V (greylist, reflection, allowed)
2023-07-14 21:42:42.254 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->arrayBaseOffset(Ljava/lang/Class;)I (greylist,core-platform-api, linking, allowed)
2023-07-14 21:42:42.254 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->arrayIndexScale(Ljava/lang/Class;)I (greylist, linking, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed)
2023-07-14 21:42:42.255 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed)
2023-07-14 21:42:42.256 458-458 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden field Ljava/nio/Buffer;->address:J (greylist, reflection, allowed)
2023-07-14 21:42:42.257 458-523 rusingfirestor com...e.budgettrackerusingfirestore I The ClassLoaderContext is a special shared library.
2023-07-14 21:42:42.286 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:42.288 458-495 OpenGLRenderer com...e.budgettrackerusingfirestore D endAllActiveAnimators on 0xdcd1a400 (RippleDrawable) with handle 0xc8897060
2023-07-14 21:42:42.289 458-523 rusingfirestor com...e.budgettrackerusingfirestore I The ClassLoaderContext is a special shared library.
2023-07-14 21:42:42.294 458-523 rusingfirestor com...e.budgettrackerusingfirestore I The ClassLoaderContext is a special shared library.
2023-07-14 21:42:42.301 458-523 rusingfirestor com...e.budgettrackerusingfirestore I Waiting for a blocking GC ClassLinker
2023-07-14 21:42:42.306 458-495 EGL_emulation com...e.budgettrackerusingfirestore D eglMakeCurrent: 0xebba5c40: ver 2 0 (tinfo 0xdcc8c260)
2023-07-14 21:42:42.309 458-471 rusingfirestor com...e.budgettrackerusingfirestore I Background young concurrent copying GC freed 30041(1197KB) AllocSpace objects, 0(0B) LOS objects, 15% free, 3443KB/4066KB, paused 612us total 159.973ms
2023-07-14 21:42:42.309 458-523 rusingfirestor com...e.budgettrackerusingfirestore I WaitForGcToComplete blocked ClassLinker on HeapTrim for 7.508ms
2023-07-14 21:42:42.310 458-523 ProviderInstaller com...e.budgettrackerusingfirestore W Failed to report request stats: com.google.android.gms.common.security.ProviderInstallerImpl.reportRequestStats [class android.content.Context, long, long]
2023-07-14 21:42:42.311 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.328 458-523 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden field Ldalvik/system/BaseDexClassLoader;->pathList:Ldalvik/system/DexPathList; (greylist, reflection, allowed)
2023-07-14 21:42:42.329 458-523 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden field Ldalvik/system/DexPathList;->nativeLibraryDirectories:Ljava/util/List; (greylist, reflection, allowed)
2023-07-14 21:42:42.331 458-523 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden field Ldalvik/system/DexPathList;->systemNativeLibraryDirectories:Ljava/util/List; (greylist, reflection, allowed)
2023-07-14 21:42:42.331 458-523 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden field Ldalvik/system/DexPathList;->nativeLibraryPathElements:[Ldalvik/system/DexPathList$NativeLibraryElement; (greylist, reflection, allowed)
2023-07-14 21:42:42.331 458-523 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Ldalvik/system/DexPathList;->makePathElements(Ljava/util/List;)[Ldalvik/system/DexPathList$NativeLibraryElement; (greylist, reflection, allowed)
2023-07-14 21:42:42.333 458-523 NativeCrypto com...e.budgettrackerusingfirestore V Registering com/google/android/gms/org/conscrypt/NativeCrypto's 286 native methods...
2023-07-14 21:42:42.355 458-523 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (greylist, reflection, allowed)
2023-07-14 21:42:42.358 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.358 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2023-07-14 21:42:42.392 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.396 458-523 ProviderInstaller com...e.budgettrackerusingfirestore I Installed default security provider GmsCore_OpenSSL
2023-07-14 21:42:42.404 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2023-07-14 21:42:42.408 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2023-07-14 21:42:42.415 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2023-07-14 21:42:42.447 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2023-07-14 21:42:42.447 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2023-07-14 21:42:42.447 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.447 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2023-07-14 21:42:42.450 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.454 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.456 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2023-07-14 21:42:42.460 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2023-07-14 21:42:42.466 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2023-07-14 21:42:42.471 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2023-07-14 21:42:42.472 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2023-07-14 21:42:42.491 458-562 rusingfirestor com...e.budgettrackerusingfirestore W Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
型
1条答案
按热度按时间mm5n2pyu1#
这招真管用!!数据更新为Firestore。我刚刚从我使用的像素模拟器改变到我的物理三星设备Idk为什么运行应用程序突然使它工作,但它只是奇迹般地做到了。即使模拟器连接到互联网。编辑:-使用物理设备而不是模拟器解决了这个问题,因为模拟器无法向Firestore添加数据