更改 .ohpmignore 配置后,需清空相应模块的 build 文件夹,或在DevEco Studio中选择 Build -> clean project,然后再进行打包。
开启方式:在模块级build-profile.json5文件的“obfuscation”字段中配置混淆功能。
配置如下:
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
}
},
],
// ...
} 具体内容可参考链接:混淆加固。