程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了读取 Sqlite 数据库时出错:找不到数据库 google_app_measurement_local.db大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决读取 SQLite 数据库时出错:找不到数据库 google_app_measurement_local.db?

开发过程中遇到读取 SQLite 数据库时出错:找不到数据库 google_app_measurement_local.db的问题如何解决?下面主要结合日常开发的经验,给出你关于读取 SQLite 数据库时出错:找不到数据库 google_app_measurement_local.db的解决方法建议,希望对你解决读取 SQLite 数据库时出错:找不到数据库 google_app_measurement_local.db有所启发或帮助;

我在启动应用程序时突然在事件日志中收到此信息 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"

解决方法

发生这种情况的原因有很多,例如:

  1. Android studio IDE(数据库检查器)存在错误
  2. 构建缓存已损坏
  3. 您使用的 google 库可能存在版本冲突
    ================================================== ====

Android studio IDE(数据库检查器)存在错误

在这种情况下,作为正确的修复,您可以做的并不多,但作为一种解决方法, 您可以禁用数据库检查器。正如您所提到的,您使用的是 Android studio 4.2,并且该版本可以让用户禁用数据库检查器。

Android studio 4.2.0+

Database Inspector -> (device list dropdown in top-left corner) -> Stop Inspector

低于 4.2.0

File -> Invalidate Caches/Restart -> Just Restart (no need to invalidate caches)

构建缓存已损坏

只需使缓存无效并重新启动项目

File -> Invalidate Caches/Restart -> Invalidate and Restart

如果其构建文件夹已损坏,这应该可以解决问题。

Firebase 库发生冲突

首先,确保您拥有所有这些的最新版本。 但我必须推荐使用 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'
}

我希望这可以为您解决问题。 如果 IDE 解决方法适合您,请确保file a bug/Issue to Google。

大佬总结

以上是大佬教程为你收集整理的读取 Sqlite 数据库时出错:找不到数据库 google_app_measurement_local.db全部内容,希望文章能够帮你解决读取 Sqlite 数据库时出错:找不到数据库 google_app_measurement_local.db所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。