Android服务中的FireStore不起作用。数据库锁定错误

时间:2018-04-12 05:52:58

标签: android google-cloud-firestore

当我尝试从firestore访问数据时出现以下错误。尝试将持久性设置为true但得到相同的错误。

java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).

at com.google.android.gms.internal.zzeyi.run(Unknown Source)

at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:154)

at android.app.ActivityThread.main(ActivityThread.java:6123)

at java.lang.reflect.Method.invoke(Native Method)                                                                                          
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

Caused by: java.lang.RuntimeException: Failed to gain exclusive lock to the Firestore client's offline persistence. This generally means you are using 
Firestore from multiple processes in your app. Keep in mind that multi- 
process Android apps execute the code in your Application class in all 
processes, so you may need to avoid initializing Firestore in your 
Application class. If you are intentionally using Firestore from multiple 
processes, you can only enable offline persistence (i.e. call s 
setPersistenceEnabled(true)) in one of them.

at com.google.android.gms.internal.zzetz.zza(Unknown Source)

at com.google.android.gms.internal.zzeqp.zza(Unknown Source)

at com.google.android.gms.internal.zzeqr.run(Unknown Source)

我的应用程序中有一个服务并在单独的过程中运行

 <service
        android:name=".ReceivingOrderService"
        android:enabled="true"
        android:exported="true"
        android:process=":receivingorder"></service>

1 个答案:

答案 0 :(得分:0)

抱歉,我刚刚玩了代码并设置了

setPersistenceEnabled(true)

setPersistenceEnabled(false)