Tencent / MMKV

An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.
Other
17.26k stars 1.89k forks source link

[Feature Request]能提供一个适配了Android 15 16KB的版本吗 #1353

Open lukezhu2023 opened 2 months ago

lukezhu2023 commented 2 months ago

https://developer.android.com/guide/practices/page-sizes?hl=zh-cn

lingol commented 2 months ago

I understand that using 16K Pagesize will enhance memory efficiency (iOS uses 16K for a loooong time).

I have taken a quick look at the docs you posted. Looks like that requires an upgrade on NDK & AGP, and a complete review on the core source code on Pagesize. That's a lot of work.

So it won't be soon.

kaitian521 commented 2 months ago

https://github.com/search?q=repo%3ATencent%2FMMKV%204096&type=code

maybe all is right in 16K pagesize

lingol commented 2 months ago

https://github.com/search?q=repo%3ATencent%2FMMKV%204096&type=code

maybe all is right in 16K pagesize

Maybe.

The AGP plugin update is yet another painful job. Last time I did it the publish-to-maven script was broken and had to rollback.

lukezhu2023 commented 1 month ago

@lingol 能直接使用NDK 或者cmake编译 出so库吗?这样就可以不升级AGP?

lingol commented 1 month ago

@lingol 能直接使用NDK 或者cmake编译 出so库吗?这样就可以不升级AGP?

Maybe. It's not in our top priority though. I have checked with some senior Android devs and find out that no major brands turn on 16K on Android 15.

Nullifier1571 commented 1 month ago

尊敬的开发者: 您好!目前小米已发布了Android 15预览版,开放平台也同步上线了带有新系统的远程真机,请开发者启动适配工作,并于2024年8月31日之前完成适配! 若您在2024年8月31日前未进行处理,我们将按照产品对用户的影响程度,采取相关措施以保障用户使用体验,包括但不限于“搜索标签提示”、“应用降级”、“分机型屏蔽”、“应用下架”。 请各位开发者及时调整,小米与您一起建设更好的Android 生态。

咨询了下小米工程师年内可能没计划进行16k对齐但是还是推荐先提前做好对齐工作,其他厂商还不了解。目前我们应用使用了mmkv在谷歌提供的模拟器上必崩。

java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/~~NHViVslYBhncFDynZV6M9A==/com.wuba-Ll6_cDr4REu_oyprb9oFFg==/lib/arm64/libmmkv.so" (new hash type from the future?)

lingol commented 1 month ago

new hash type from the future?

Looks like a bug in the system image. MMKV is built with NDK26, so no way has anything from the future. May I suggest you make a bug report to the Google team?

Nullifier1571 commented 1 month ago

可以参考 https://github.com/Tencent/MMKV/wiki/android_setup_cn https://developer.android.com/guide/practices/page-sizes?hl=zh-cn#cmake 编译一个支持16k的aar,目前我已经解决了该问题

lingol commented 1 month ago

@Nullifier1571 that's good to know, thank you.

lukezhu2023 commented 1 month ago

可以参考 https://github.com/Tencent/MMKV/wiki/android_setup_cn https://developer.android.com/guide/practices/page-sizes?hl=zh-cn#cmake 编译一个支持16k的aar,目前我已经解决了该问题

你好,你是编译了一个支持16KB的MMKV版本了吗?方便共享吗?另外我看官方文档还是要改写代码的,比如代码里写死了4096的地方

Nullifier1571 commented 1 month ago

https://github.com/Nullifier1571/mmkvaar/

fanlb commented 4 weeks ago

了解的片面了, 适配android最新版本特性, 几乎是每个移动端团队每年必做的事情, 对现有app产生crash的变动 更会格外重视

@lingol能直接使用NDK或者cmake编译出so库吗?这样就可以不升级AGP吗?

也许吧。不过这并不是我们的首要任务。我咨询了一些资深 Android 开发人员,发现没有哪个大品牌会在 Android 15 上启用 16K。

lingol commented 4 weeks ago

Just so all you know, 16K is supported in the dev branch and will be available in the next version v2.0.

mrousavy commented 6 hours ago

Nice work @lingol !