MMKV icon indicating copy to clipboard operation
MMKV copied to clipboard

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

Open xiaoyaoyouzi163com opened this issue 1 year ago • 14 comments

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 avatar Aug 20 '24 07:08 xiaoyaoyouzi163com

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

xiaoyaoyouzi163com avatar Aug 20 '24 08:08 xiaoyaoyouzi163com

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

lingol avatar Aug 20 '24 08:08 lingol

你怎么处理的混淆?

limuyang2 avatar Aug 23 '24 06:08 limuyang2

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

tanranran avatar Aug 26 '24 06:08 tanranran

同问

zhouqj1414657557 avatar Aug 28 '24 09:08 zhouqj1414657557

-keep-global-name MMKV native

-keep-property-name getDefaultMMKV

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

hrp-ai avatar Sep 02 '24 07:09 hrp-ai

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

sunwen0402 avatar Sep 03 '24 00:09 sunwen0402

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 avatar Sep 09 '24 10:09 lingol

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

lingol avatar Sep 23 '24 12:09 lingol

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

Er3c avatar Sep 25 '24 02:09 Er3c

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

lingol avatar Sep 25 '24 06:09 lingol

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.

lingol avatar Sep 25 '24 12:09 lingol

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

bluesky0506 avatar Sep 29 '24 02:09 bluesky0506

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

-keep-property-name getDefaultMMKV

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

TheLittleBoy avatar Oct 18 '24 03:10 TheLittleBoy

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

lingol avatar Oct 22 '24 01:10 lingol

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

-keep-property-name getDefaultMMKV

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

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

wangyatong avatar Oct 23 '24 09:10 wangyatong

It's fully supported in v2.0.2.

lingol avatar Jan 02 '25 09:01 lingol