Android Studio 应用程序崩溃数据库应用程序崩溃错误
2022-02-26 00:24:09.641 32217-32217/com.example.kampusegel1 E/SQLiteAssetHelper:无法打开 EatItDB.db 进行写入(将尝试只读): com.readystatesoftware.sqliteasset.SQLiteAssetHelper$SQLiteAssetException:资产中缺少数据库/EatItDB.db 文件(或 .zip、.gz 存档),或目标文件夹不可写 在 android.content.res.AssetManager.nativeOpenAsset(本机方法) 在 android.content.res.AssetManager.open(AssetManager.java:875) 在 android.content.res.AssetManager.open(AssetManager.java:852) 在com.readystatesoftware.sqliteasset.SQLiteAssetHelper.copyDatabaseFromAssets(SQLiteAssetHelper.java:436) 在com.readystatesoftware.sqliteasset.SQLiteAssetHelper.createOrOpenDatabase(SQLiteAssetHelper.java:400) 在com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getWritableDatabase(SQLiteAssetHelper.java:176) 在com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:254) 在 com.example.kampusegel1.Database.Database.addToCart(Database.java:55) 在 com.example.kampusegel1.FoodDetail$1.onClick(FoodDetail.java:58) 在 android.view.View.performClick(View.java:7870) 在 android.widget.TextView.performClick(TextView.java:14970) 在 android.view.View.performClickInternal(View.java:7839) 在 android.view.View.access$3600(View.java:886) 在 android.view.View$PerformClick.run(View.java:29363) 在 android.os.Handler.handleCallback(Handler.java:883) 在 android.os.Handler.dispatchMessage(Handler.java:100) 在 android.os.Looper.loop(Looper.java:237) 在 android.app.ActivityThread.main(ActivityThread.java:7860) 在 java.lang.reflect.Method.invoke(本机方法) 在 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 W/SQLiteLog: (28) 无法打开“/data/user/0/com.example.kampusegel1/databases/EatItDB.db”由于错误 (2),标志 (131072) 和 mode_t (0) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (14) 无法打开 [68b898381a] 第 37805 行的文件 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (14) os_unix.c:37805: (2) 打开(/data/user/0/com.example.kampusegel1/数据库/EatItDB.db) - 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) 进程 ple.kampusegel1 : Pid (32217) Uid (10420) Euid (10420) Gid (10420) Egid (10420 ) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) osStat 因“/data/user/0/com.example.kampusegel1/databases/EatItDB.db”失败错误 (2) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) /data/user/0/com.example.kampusegel1/databases 的统计:st_mode(40771) st_uid(10420) ) st_gid(10420)圣诺(3678242) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) /data/user/0/com.example.kampusegel1 的统计: st_mode(40700) st_uid(10420) st_gid (10420)圣诺(3678239) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) /data/user/0 的统计: st_mode(40771) st_uid(1000) st_gid(1000) st_ino(3473409 ) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) /data/user 的统计: st_mode(40711) st_uid(1000) st_gid(1000) st_ino(2555905) 2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) /data 的统计: st_mode(40771) st_uid(1000) st_gid(1000) st_ino(2) 2022-02-26 00:24:09.646 32217-32217/com.example.kampusegel1 E/SQLiteDatabase:无法打开数据库“/data/user/0/com.example.kampusegel1/databases/EatItDB.db”。 android.database.sqlite.SQLiteCantOpenDatabaseException:未知错误(代码1294 SQLITE_CANTOPEN_ENOENT[1294]):无法打开数据库 在 android.database.sqlite.SQLiteConnection.nativeOpen(本机方法) 在 android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:300) 在 android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218) 在 android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737) 在 android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284) 在 android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251) 在 android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1386) 在 android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1331) 在 android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:994) 在 android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:940) 在com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:264) 在 com.example.kampusegel1.Database.Database.addToCart(Database.java:55) 在 com.example.kampusegel1.FoodDetail$1.onClick(FoodDetail.java:58) 在 android.view.View.performClick(View.java:7870) 在 android.widget.TextView.performClick(TextView.java:14970) 在 android.view.View.performClickInternal(View.java:7839) 在 android.view.View.access$3600(View.java:886) 在 android.view.View$PerformClick.run(View.java:29363) 在 android.os.Handler.handleCallback(Handler.java:883) 在 android.os.Handler.dispatchMessage(Handler.java:100) 在 android.os.Looper.loop(Looper.java:237) 在 android.app.ActivityThread.main(ActivityThread.java:7860) 在 java.lang.reflect.Method.invoke(本机方法) 在 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075) 2022-02-26 00:24:09.646 32217-32217/com.example.kampusegel1 D/AndroidRuntime:关闭虚拟机 2022-02-26 00:24:09.647 32217-32217/com.example.kampusegel1 E/AndroidRuntime: 致命异常: main 进程:com.example.kampusegel1,PID:32217 android.database.sqlite.SQLiteCantOpenDatabaseException:未知错误(代码1294 SQLITE_CANTOPEN_ENOENT[1294]):无法打开数据库 在 android.database.sqlite.SQLiteConnection.nativeOpen(本机方法) 在 android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:300) 在 android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218) 在 android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737) 在 android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284) 在 android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251) 在 android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1386) 在 android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1331) 在 android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:994) 在 android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:940) 在com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:264) 在 com.example.kampusegel1.Database.Database.addToCart(Database.java:55) 在 com.example.kampusegel1.FoodDetail$1.onClick(FoodDetail.java:58) 在 android.view.View.performClick(View.java:7870) 在 android.widget.TextView.performClick(TextView.java:14970) 在 android.view.View.performClickInternal(View.java:7839) 在 android.view.View.access$3600(View.java:886) 在 android.view.View$PerformClick.run(View.java:29363) 在 android.os.Handler.handleCallback(Handler.java:883) 在 android.os.Handler.dispatchMessage(Handler.java:100) 在 android.os.Looper.loop(Looper.java:237) 在 android.app.ActivityThread.main(ActivityThread.java:7860) 在 java.lang.reflect.Method.invoke(本机方法) 在 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
这就是当我单击按钮时应用程序崩溃的方式。 我创建了资产/数据库文件夹。 我也删除了缓存文件,但我的问题仍然没有解决。
你能帮助我吗?
2022-02-26 00:24:09.641 32217-32217/com.example.kampusegel1 E/SQLiteAssetHelper: Couldn't open EatItDB.db for writing (will try read-only):
com.readystatesoftware.sqliteasset.SQLiteAssetHelper$SQLiteAssetException: Missing databases/EatItDB.db file (or .zip, .gz archive) in assets, or target folder not writable
at android.content.res.AssetManager.nativeOpenAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:875)
at android.content.res.AssetManager.open(AssetManager.java:852)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.copyDatabaseFromAssets(SQLiteAssetHelper.java:436)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.createOrOpenDatabase(SQLiteAssetHelper.java:400)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getWritableDatabase(SQLiteAssetHelper.java:176)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:254)
at com.example.kampusegel1.Database.Database.addToCart(Database.java:55)
at com.example.kampusegel1.FoodDetail$1.onClick(FoodDetail.java:58)
at android.view.View.performClick(View.java:7870)
at android.widget.TextView.performClick(TextView.java:14970)
at android.view.View.performClickInternal(View.java:7839)
at android.view.View.access$3600(View.java:886)
at android.view.View$PerformClick.run(View.java:29363)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7860)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 W/SQLiteLog: (28) failed to open "/data/user/0/com.example.kampusegel1/databases/EatItDB.db" with flag (131072) and mode_t (0) due to error (2)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (14) cannot open file at line 37805 of [68b898381a]
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (14) os_unix.c:37805: (2) open(/data/user/0/com.example.kampusegel1/databases/EatItDB.db) -
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) Process ple.kampusegel1 : Pid (32217) Uid (10420) Euid (10420) Gid (10420) Egid (10420)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) osStat failed "/data/user/0/com.example.kampusegel1/databases/EatItDB.db" due to error (2)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) Stat of /data/user/0/com.example.kampusegel1/databases : st_mode(40771) st_uid(10420) st_gid(10420) st_ino(3678242)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) Stat of /data/user/0/com.example.kampusegel1 : st_mode(40700) st_uid(10420) st_gid(10420) st_ino(3678239)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) Stat of /data/user/0 : st_mode(40771) st_uid(1000) st_gid(1000) st_ino(3473409)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) Stat of /data/user : st_mode(40711) st_uid(1000) st_gid(1000) st_ino(2555905)
2022-02-26 00:24:09.644 32217-32217/com.example.kampusegel1 E/SQLiteLog: (1) Stat of /data : st_mode(40771) st_uid(1000) st_gid(1000) st_ino(2)
2022-02-26 00:24:09.646 32217-32217/com.example.kampusegel1 E/SQLiteDatabase: Failed to open database '/data/user/0/com.example.kampusegel1/databases/EatItDB.db'.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 1294 SQLITE_CANTOPEN_ENOENT[1294]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:300)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1386)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1331)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:994)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:940)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:264)
at com.example.kampusegel1.Database.Database.addToCart(Database.java:55)
at com.example.kampusegel1.FoodDetail$1.onClick(FoodDetail.java:58)
at android.view.View.performClick(View.java:7870)
at android.widget.TextView.performClick(TextView.java:14970)
at android.view.View.performClickInternal(View.java:7839)
at android.view.View.access$3600(View.java:886)
at android.view.View$PerformClick.run(View.java:29363)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7860)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
2022-02-26 00:24:09.646 32217-32217/com.example.kampusegel1 D/AndroidRuntime: Shutting down VM
2022-02-26 00:24:09.647 32217-32217/com.example.kampusegel1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.kampusegel1, PID: 32217
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 1294 SQLITE_CANTOPEN_ENOENT[1294]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:300)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1386)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1331)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:994)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:940)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:264)
at com.example.kampusegel1.Database.Database.addToCart(Database.java:55)
at com.example.kampusegel1.FoodDetail$1.onClick(FoodDetail.java:58)
at android.view.View.performClick(View.java:7870)
at android.widget.TextView.performClick(TextView.java:14970)
at android.view.View.performClickInternal(View.java:7839)
at android.view.View.access$3600(View.java:886)
at android.view.View$PerformClick.run(View.java:29363)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7860)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
This is how the app crashes when I click the button.
I created the assets/databases folder.
I also deleted the cache files, but my problem is still not resolved.
Can you help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有更新版本吗?
卸载重新运行,如果通过了,肯定是没有更新,数据版本
来自中国,英文不好
Is there an updated version?
Uninstalled and re-run, if passed, it must be no update, the version of the data
From China, English is not good