Mik*_*ike 11 sqlite android kotlin android-room
突然我在启动应用程序时在事件日志中得到这个
Database Inspector: Error reading Sqlite database: Database 'LiveSqliteDatabaseId(path=/data/data/app-dir/databases/google_app_measurement_local.db, name=google_app_measurement_local.db, connectionId=1) not found
检查数据库路径后,我看到目录中有 google_app_measurement_local.db。知道是什么导致出现这种情况吗?
顺便说一句,我使用的是 Android Studio 4.2,这里是这个应用程序的 Firebase 版本
implementation "com.google.firebase:firebase-core:19.0.0"
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'com.google.firebase:firebase-crashlytics:18.0.0'
implementation "com.google.firebase:firebase-database:20.0.0"
implementation "com.google.firebase:firebase-config:21.0.0"
Run Code Online (Sandbox Code Playgroud)
发生这种情况的原因有很多,例如:
在这种情况下,您实际上无法做太多正确的修复,但作为解决方法,您可以禁用数据库检查器。正如您所提到的,您正在使用 Android studio 4.2,该版本可以让用户禁用数据库检查器。
Android Studio 4.2.0+
Database Inspector -> (device list dropdown in top-left corner) -> Stop Inspector
Run Code Online (Sandbox Code Playgroud)
4.2.0以下
File -> Invalidate Caches/Restart -> Just Restart (no need to invalidate caches)
Run Code Online (Sandbox Code Playgroud)
只需使缓存失效并重新启动项目即可
File -> Invalidate Caches/Restart -> Invalidate and Restart
Run Code Online (Sandbox Code Playgroud)
如果其构建文件夹已损坏,这应该可以解决问题。
首先,确保您拥有所有这些的最新版本。但我必须建议使用Firebase Android Bom来对 Firebase 库进行版本控制。它会自动控制应为您包含在应用程序 Gralde 文件中的每个库选择哪些版本。参见示例:
dependencies {
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:28.3.0')
// Declare the dependencies for the desired Firebase products without specifying versions
// For example, declare the dependencies for Firebase Authentication and Cloud Firestore
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'
}
Run Code Online (Sandbox Code Playgroud)
我希望这能为您解决问题。如果 IDE 解决方法适合您,请务必向 Google 提交错误/问题。