Firebase崩溃导致Android应用

时间:2016-05-24 12:53:40

标签: firebase firebase-realtime-database

从后台服务获取firebase引用时出现以下错误:

  

引起:com.google.firebase.database.DatabaseException:调用   setPersistenceEnabled()必须在任何其他用法之前生成   FirebaseDatabase实例。                                                                                  在com.google.firebase.database.FirebaseDatabase.zzhM(未知来源)                                                                                  在   com.google.firebase.database.FirebaseDatabase.setPersistenceEnabled(未知   资源)                                                                                  在   com.firstnotify.moveit.Activity.LoginActivity.initFirebase(LoginActivity.java:104)                                                                                  在   com.firstnotify.moveit.Activity.LoginActivity.onCreate(LoginActivity.java:98)                                                                                  在android.app.Activity.performCreate(Activity.java:5990)                                                                                  在   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)                                                                                  在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)                                                                                  在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)                                                                                  在android.app.ActivityThread.access $ 800(ActivityThread.java:151)                                                                                  在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1303)                                                                                  在android.os.Handler.dispatchMessage(Handler.java:102)                                                                                  在android.os.Looper.loop(Looper.java:135)                                                                                  在android.app.ActivityThread.main(ActivityThread.java:5254)                                                                                  at java.lang.reflect.Method.invoke(Native Method)                                                                                  在java.lang.reflect.Method.invoke(Method.java:372)                                                                                  在   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:903)                                                                                  在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

是否可以从后台服务更新firebase实时数据库,因为在我的应用程序中,当我尝试从活动中工作时它正常工作但是从服务中尝试时遇到此特定错误

0 个答案:

没有答案