当我通过iOS模拟器连接到数据库时,一切正常,并且没有任何错误,但是当我打开android studio android模拟器时,出现此错误,
I/System.out(26315): com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions.
这是我的数据库规则:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
allow write: if true;
}
}
}
这是完整的控制台
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
W/lmalab.leadsap(26315): Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (light greylist, reflection)
W/lmalab.leadsap(26315): Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (light greylist, reflection)
W/lmalab.leadsap(26315): Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (light greylist, reflection)
W/lmalab.leadsap(26315): Accessing hidden method Landroid/util/LongArray;->get(I)J (light greylist, reflection)
Syncing files to device AOSP on IA Emulator...
I/OpenGLRenderer(26315): Initialized EGL, version 1.4
D/OpenGLRenderer(26315): Swap behavior 1
D/HostConnection(26315): HostConnection::get() New Host Connection established 0xe2a1e960, tid 26363
D/HostConnection(26315): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
W/OpenGLRenderer(26315): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer(26315): Swap behavior 0
D/HostConnection(26315): HostConnection::get() New Host Connection established 0xe0b52960, tid 26353
D/eglCodecCommon(26315): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation(26315): eglCreateContext: 0xe2a059c0: maj 3 min 0 rcv 3
D/EGL_emulation(26315): eglMakeCurrent: 0xe2a059c0: ver 3 0 (tinfo 0xc93f0f10)
D/HostConnection(26315): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
D/eglCodecCommon(26315): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation(26315): eglCreateContext: 0xe0fa2580: maj 3 min 0 rcv 3
D/HostConnection(26315): createUnique: call
D/HostConnection(26315): HostConnection::get() New Host Connection established 0xe2a1ebe0, tid 26363
E/eglCodecCommon(26315): GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
D/EGL_emulation(26315): eglMakeCurrent: 0xe0fa2580: ver 3 0 (tinfo 0xe8c3ee20)
D/HostConnection(26315): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
I/lmalab.leadsap(26315): Background concurrent copying GC freed 24908(6MB) AllocSpace objects, 7(156KB) LOS objects, 49% free, 1943KB/3MB, paused 1.399ms total 301.065ms
I/Choreographer(26315): Skipped 88 frames! The application may be doing too much work on its main thread.
D/EGL_emulation(26315): eglMakeCurrent: 0xe2a059c0: ver 3 0 (tinfo 0xc93f0f10)
D/eglCodecCommon(26315): setVertexArrayObject: set vao to 0 (0) 1 2
I/OpenGLRenderer(26315): Davey! duration=1630ms; Flags=1, IntendedVsync=73894474127663, Vsync=73895940794271, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=73895949697031, AnimationStart=73895949775031, PerformTraversalsStart=73895949805031, DrawStart=73895960396031, SyncQueued=73895968932031, SyncStart=73895973866031, IssueDrawCommandsStart=73895974155031, SwapBuffers=73896017486031, FrameCompleted=73896109549031, DequeueBufferDuration=48502000, QueueBufferDuration=1485000,
D/EGL_emulation(26315): eglMakeCurrent: 0xe0fa2580: ver 3 0 (tinfo 0xe8c3ee20)
D/eglCodecCommon(26315): setVertexArrayObject: set vao to 0 (0) 1 0
I/flutter (26315): null
W/DynamiteModule(26315): Local module descriptor class for providerinstaller not found.
I/DynamiteModule(26315): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller(26315): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
I/lmalab.leadsap(26315): The ClassLoaderContext is a special shared library.
W/lmalab.leadsap(26315): Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
I/lmalab.leadsap(26315): The ClassLoaderContext is a special shared library.
I/chatty (26315): uid=10086(com.lab.leadsapp) AsyncTask #2 identical 1 line
I/lmalab.leadsap(26315): The ClassLoaderContext is a special shared library.
V/NativeCrypto(26315): Registering com/google/android/gms/org/conscrypt/NativeCrypto's 284 native methods...
W/lmalab.leadsap(26315): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (light greylist, reflection)
D/NetworkSecurityConfig(26315): No Network Security Config specified, using platform default
I/ProviderInstaller(26315): Installed default security provider GmsCore_OpenSSL
W/lmalab.leadsap(26315): Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (light greylist, reflection)
W/lmalab.leadsap(26315): Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (light greylist, linking)
W/lmalab.leadsap(26315): Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (light greylist, linking)
W/lmalab.leadsap(26315): Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (light greylist, JNI)
W/lmalab.leadsap(26315): Accessing hidden method Ljava/security/spec/ECParameterSpec;->setCurveName(Ljava/lang/String;)V (light greylist, reflection)
W/lmalab.leadsap(26315): Accessing hidden method Ldalvik/system/BlockGuard;->getThreadPolicy()Ldalvik/system/BlockGuard$Policy; (light greylist, linking)
W/lmalab.leadsap(26315): Accessing hidden method Ldalvik/system/BlockGuard$Policy;->onNetwork()V (light greylist, linking)
W/Firestore(26315): (21.3.0) [Firestore]: Listen for Query(leads order by __name__) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}
I/System.out(26315): com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions.
W/lmalab.leadsap(26315): Accessing hidden method Ldalvik/system/CloseGuard;->close()V (light greylist, linking)
W/lmalab.leadsap(26315): Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (light greylist, linking)
在iOS模拟器和真实的iOS设备上,一切正常,没有错误
firestore: PERMISSION_DENIED: Missing or insufficient permissions 这些解决方案都无济于事