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

fail to open:/data/user/0/com.test.phone/files/mmkv/mmkv.default, No such file or directory #348

Closed
s3hengwu opened this issue Nov 1, 2019 · 3 comments

Comments

@s3hengwu
Copy link

s3hengwu commented Nov 1, 2019

我有个时间每隔1分钟会保存一次,此时我重启手机,收到自启动广播后,我再读这个时间,报错:
3043/? E/MMKV: MmapedFile.cpp:43::MmapedFile fail to open:/data/user/0/com.test.phone/files/mmkv/mmkv.default.crc, No such file or directory
2019-11-01 20:18:32.382 3043-3043/? E/MMKV: MMKV.cpp:311::loadFromFile fail to open:/data/user/0/com.test.phone/files/mmkv/mmkv.default, No such file or directory.
自启动失败后,我手动去打开我的app。我有个字段保存是否是首次打开,也是用的这个库,此时为默认值true。
W/MMKV: MMKV.cpp:703::ensureMemorySize [mmkv.default] file not valid

@lingol
Copy link
Collaborator

lingol commented Nov 1, 2019

I don't really understand your question. You might consider making it more clear.

@s3hengwu
Copy link
Author

s3hengwu commented Nov 1, 2019

简单说就是重启后,缓存数据没了。目前发现荣耀10会这样,红米note8正常

@s3hengwu
Copy link
Author

s3hengwu commented Nov 2, 2019

修复好了,新增了一下数据恢复:
public MMKVRecoverStrategic onMMKVCRCCheckFail(String s) {
return MMKVRecoverStrategic.OnErrorRecover;
}

        @Override
        public MMKVRecoverStrategic onMMKVFileLengthError(String s) {
            return MMKVRecoverStrategic.OnErrorRecover;
        }

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

2 participants