HarmonyOS entry中配置混淆后Har包中native接口调用不到 ?
Har包配置了混淆,将native接口单独keep了下来,例如WDComputeHash
-enable-property-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation
-enable-toplevel-obfuscation
-enable-string-property-obfuscation
-remove-comments
-compact
-keep-property-name
WDComputeHash
通过release模式生成har包后,entry调har接口,har中native接口调用不到,发现entry配置混淆不生效才能正常调用到。
"ruleOptions": {
"enable": false,
"files": [
"./obfuscation-rules.txt"
]
}
WDComputeHash如果是类或方法的话,需要使用-keep-global-name保留白名单对har模块构建之前最好clean一下项目。