Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 9.0 数据库文件替换后,无法读取数据库内容 #533

Closed
ihewro opened this issue May 23, 2019 · 7 comments
Closed

Android 9.0 数据库文件替换后,无法读取数据库内容 #533

ihewro opened this issue May 23, 2019 · 7 comments

Comments

@ihewro
Copy link

ihewro commented May 23, 2019

在android 9.0以下版本都是正常的

具体功能是:数据库备份到SD卡中,然后再将SD卡中的数据库.db文件替换应用内部的数据库文件。

其中的路径都是正确的。

成功替换后,甚至在AS的Device explorer 体积大小都是正确的,但是应用似乎没有读取这个数据库。

Google一圈似乎是andriod WAL特性,但不知道如何解决?求教

相关地址:https://blog.csdn.net/u010913414/article/details/88076794
https://blog.csdn.net/dtskyline/article/details/88781655
storesafe/cordova-sqlite-storage#810

@nichao123
Copy link

nichao123 commented May 24, 2019 via email

@nichao123
Copy link

nichao123 commented May 24, 2019 via email

@ihewro
Copy link
Author

ihewro commented May 24, 2019

解决了,谢谢,谢谢

------------------ 原始邮件 ------------------ 发件人: "我愿人长久"notifications@github.com; 发送时间: 2019年5月23日(星期四) 晚上10:13 收件人: "LitePalFramework/LitePal"LitePal@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: [LitePalFramework/LitePal] Android 9.0 数据库文件替换后,无法读取数据库内容 (#533) 在android 9.0以下版本都是正常的 具体功能是:数据库备份到SD卡中,然后再将SD卡中的数据库.db文件替换应用内部的数据库文件。 其中的路径都是正确的。 成功替换后,甚至在AS的Device explorer 体积大小都是正确的,但是应用似乎没有读取这个数据库。 Google一圈似乎是andriod WAL特性,但不知道如何解决?求教 相关地址:https://blog.csdn.net/u010913414/article/details/88076794 https://blog.csdn.net/dtskyline/article/details/88781655 xpbrew/cordova-sqlite-storage#810 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

请问是如何解决的呢?

@ihewro
Copy link
Author

ihewro commented May 26, 2019

解决了,谢谢,谢谢

------------------ 原始邮件 ------------------ 发件人: "OnexZgj"notifications@github.com; 发送时间: 2019年5月24日(星期五) 下午4:22 收件人: "LitePalFramework/LitePal"LitePal@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: Re: [LitePalFramework/LitePal] Android 9.0 数据库文件替换后,无法读取数据库内容 (#533) 大兄弟,你解决了吗?这边是生成3个文件,原始文件很小,生成另外2个单独文件 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

朋友还在吗

@ihewro
Copy link
Author

ihewro commented May 27, 2019

贴下解决方法吧:

就是在myapplicationonCreate()里面加上一行:

        LitePal.getDatabase().disableWriteAheadLogging();

表示禁用这种特性了,禁用之后之前在wal特性下备份的数据库无法恢复的(可能是某些格式不一样),在禁用之后备份的数据库可以正常恢复~

@ihewro ihewro closed this as completed May 27, 2019
@xieliuhao
Copy link

LitePal.getDatabase().disableWriteAheadLogging();

大佬,请问一下,你的备份方式是文件流形式吗,备份和恢复时需要注意什么?

@ihewro
Copy link
Author

ihewro commented Jan 28, 2020

LitePal.getDatabase().disableWriteAheadLogging();

大佬,请问一下,你的备份方式是文件流形式吗,备份和恢复时需要注意什么?

是.db 的文件,好像没有什么需要特别注意的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants