HarmonyOS entry中配置混淆后Har包中native接口调用不到 ?

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" 
  ] 
}
阅读 702
1 个回答

WDComputeHash如果是类或方法的话,需要使用-keep-global-name保留白名单对har模块构建之前最好clean一下项目。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进