Firebase:数据库“/google_app_measurement_local.db”未打开

Firebase: The database '/google_app_measurement_local.db' is not open

在我的 android 应用程序中开始使用 Firebase 进行事件记录后,我在启动我的应用程序时不断收到这些错误消息:

E/System: java.lang.IllegalStateException: The database '/...folder here.../google_app_measurement_local.db' is not open.
              at android.database.sqlite.SQLiteDatabase.throwIfNotOpenLocked(SQLiteDatabase.java:2169)
              at android.database.sqlite.SQLiteDatabase.createSession(SQLiteDatabase.java:365)
              at android.database.sqlite.SQLiteDatabase.initialValue(SQLiteDatabase.java:84)
              at android.database.sqlite.SQLiteDatabase.initialValue(SQLiteDatabase.java:83)
              at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
              at java.lang.ThreadLocal.get(ThreadLocal.java:65)
              at android.database.sqlite.SQLiteDatabase.getThreadSession(SQLiteDatabase.java:359)
              at android.database.sqlite.SQLiteProgram.getSession(SQLiteProgram.java:101)
              at android.database.sqlite.SQLiteQuery.setLastStmt(SQLiteQuery.java:96)
              at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:111)
              at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:300)
              at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:366)
              at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:202)
              at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
              at java.lang.Thread.run(Thread.java:818)

这是我的 build.gradle 的片段:

dependencies {
    compile 'com.android.support:support-v4:25.0.0'
    compile 'com.google.firebase:firebase-analytics:9.8.0'
    compile 'com.google.firebase:firebase-crash:9.8.0'
    compile files('src/main/resources/simple-xml-2.7.jar')
    compile files('src/main/resources/date4j.jar')
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile files('src/main/resources/picasso-2.5.2.jar')
}

我所做的就是打电话

_firebaseAnalytics = FirebaseAnalytics.getInstance(context);

然后

_firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, payload);

我无法在网上找到任何解决方案,现在希望在这里得到帮助...

我刚刚在启用严格模式时遇到过这个问题,当添加

compile 'com.google.firebase:firebase-core:9.8.0'

我不得不使用早期版本:

compile 'com.google.firebase:firebase-core:9.6.0'

我从 Firebase Android SDK Release Notes

找到了最新版本

请移至最新版本的 firebase SDK。 Firebase 在他们更新的 SDK 中解决了这个内存泄漏问题。删除旧的 SDK 并在 gradle 文件中添加以下行。

compile 'com.google.firebase:firebase-core:11.0.1'