0

如何解决此问题昨天的应用程序正在运行,今天我运行相同的代码,在启动屏幕活动时出现运行时错误。

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.planfisheye.fisheye, PID: 11217
                  java.lang.IllegalStateException: The global database holder is not initialized. Ensure you call FlowManager.init() before accessing the database.
                      at com.raizlabs.android.dbflow.config.FlowManager.checkDatabaseHolder(FlowManager.java:507)
                      at com.raizlabs.android.dbflow.config.FlowManager.getDatabaseForTable(FlowManager.java:138)
                      at com.raizlabs.android.dbflow.config.FlowManager.getModelAdapterOrNull(FlowManager.java:469)
                      at com.raizlabs.android.dbflow.config.FlowManager.getTableName(FlowManager.java:79)
                      at com.raizlabs.android.dbflow.sql.language.From.getTableAlias(From.java:43)
                      at com.raizlabs.android.dbflow.sql.language.From.getQuery(From.java:211)
                      at com.raizlabs.android.dbflow.sql.language.BaseModelQueriable.querySingle(BaseModelQueriable.java:67)
                      at com.raizlabs.android.dbflow.sql.language.BaseTransformable.querySingle(BaseTransformable.java:106)
                      at com.planfisheye.fisheye.database.AuthenticationQueries.getUserDetails(AuthenticationQueries.java:205)
                      at com.planfisheye.fisheye.SplashActivity.checkDatabase(SplashActivity.java:205)
                      at com.planfisheye.fisheye.SplashActivity.access$100(SplashActivity.java:49)
                      at com.planfisheye.fisheye.SplashActivity$3$1.run(SplashActivity.java:187)
                      at android.os.Handler.handleCallback(Handler.java:808)
                      at android.os.Handler.dispatchMessage(Handler.java:101)
                      at android.os.Looper.loop(Looper.java:166)
                      at android.app.ActivityThread.main(ActivityThread.java:7425)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
4

1 回答 1

1

尝试在项目的 Application 类中初始化数据库。

于 2018-11-14T05:26:03.037 回答