Tencent / MMKV

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

Harmonry Next (API12 Beta3) crashed in release mode due to obfuscation #1385

Open xiaoyaoyouzi163com opened 2 months ago

xiaoyaoyouzi163com commented 2 months ago
Device info:emulator
Build info:emulator 5.0.0.36(SP1DEVC00E36R4P11log)
Fingerprint:9a7a625fe04bd5585d59ccd743ecae5659a88160429be94bc73c89cca57e4149
Module name:(这是我们的包名,请忽略)
Version:1.0.0
VersionCode:1000000
PreInstalled:No
Foreground:Yes
Pid:12515
Uid:20020050
Reason:TypeError
Error name:TypeError
Error message:is not callable
Stacktrace:
Cannot get SourceMap info, dump raw stack:
    at defaultMMKV (entry|@tencent/mmkv|1.3.9|src/main/ets/utils/MMKV.ts:47:1)
    at userId (entry|user|1.0.0|src/main/ets/user/j4.ts:64:1)
    at d110 (entry|contacts|1.0.0|src/main/ets/m5/m6.ts:14:1)
    at func_main_0 (entry|contacts|1.0.0|src/main/ets/m5/m6.ts:37:1)

Harmonry Next API12 Beta3版本 debug模式下使用正常,release模式下APP启动闪退。FaultLog日志如上所示,请帮忙查看一下,非常感谢

xiaoyaoyouzi163com commented 2 months ago

工程release模式下开启了混淆所致

lingol commented 2 months ago

Now how do you solve this problem, in the end you still need obfuscation right?

limuyang2 commented 2 months ago

你怎么处理的混淆?

tanranran commented 2 months ago

+1。请问如何处理混淆导致的问题

zhouqj1414657557 commented 2 months ago

同问

hrp-ai commented 1 month ago

-keep-global-name MMKV native

-keep-property-name getDefaultMMKV

-keep ./**/MMKV.ets
我这么写没有这个错误了,没有测试是哪个配置有用(entry 和使用的模块都配置了)

sunwen0402 commented 1 month ago

我昨天也遇到了同样的问题, 排查到大半夜,还好来着看了眼

lingol commented 1 month ago

The official support of obfuscation has just been added to the dev branch. You guys can copy from it. https://github.com/Tencent/MMKV/commit/934b7fc9f8fcb6c7ebe9784f7629f6e8b0a7351b In the next version (v2.0.0) you won't need to copy it manually, it will be handled by IDE automatically.

lingol commented 1 month ago

A beta version that fix this problem has been released in the ohpm, v2.0.0-SNAPSHOT.

Er3c commented 1 month ago

A beta version that fix this problem has been released in the ohpm, v2.0.0-SNAPSHOT. why it still crached in v2.0.0-SNAPSHOT? what should I do anything else? image

lingol commented 1 month ago

Looks like obfuscation.txt is not correctly packed into the MMKV.har. I will investigate it later.

lingol commented 1 month ago

I have tried both turning on & off the obfuscation switch of the MMKV module, but both are not working for Apps that download MMKV from the OHPM.

I guess you guys will have to manually copy and paste the obfuscation configuration from MMKV.

bluesky0506 commented 4 weeks ago

等待官方回复吧,我把混淆都去掉了。

TheLittleBoy commented 1 week ago

从ohpm下载 v2.0.0-beta1 版本,尝试后依然闪退。 目前解决办法是在主项目的混淆文件中增加配置项:

-keep-property-name getDefaultMMKV

我这试了axios网络请求也会受到混淆的影响,有啥解决办法不?

lingol commented 6 days ago

v2.0.0 just released with support obfuscation. For the time being, you will have to manually copy the content of MMKV's consumer-rules.txt into your App's obfuscation-rules.txt.

-keep
./src/main/ets/utils/MMKV.ets
./src/main/ets/utils/MMKVHandler.ets
./src/main/ets/utils/MMKVLogLevel.ets
./src/main/ets/utils/NativeBuffer.ets
./src/main/ets/utils/Util.ts

-keep-file-name
MMKV
MMKVHandler
MMKVLogLevel
NativeBuffer
Util
wangyatong commented 4 days ago

从ohpm下载 v2.0.0-beta1 版本,尝试后依然闪退。 目前解决办法是在主项目的混淆文件中增加配置项:

-keep-property-name getDefaultMMKV

我这试了axios网络请求也会受到混淆的影响,有啥解决办法不?

axios不是有bug啊 为啥不用系统的rcp呢?