主模块引入子模块报
> hvigor ERROR: Failed :entry:default@CompileArkTS...
> hvigor ERROR: ArkTS Compiler Error
ERROR: ArkTS:ERROR File: D:\code\harmonyOs\xxx\xxx\src\main\ets\common\Constants.ets:2:18
Unknown resource name 'main_text_color'.
ERROR: ArkTS:ERROR File: D:\code\harmonyOs\xxx\xxx\src\main\ets\common\Constants.ets:3:13
Unknown resource name 'color_ffffff'.
一、修改子模块module.json5模块类型:
{
"module": {
"name": "XygjProvinceCard",
"type": "har",
"description": "$string:module_desc",
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"installationFree": false,
}
}
二、build-profile.json5去掉entryModules
{
"apiType": "stageMode",
"buildOption": {
"arkOptions": {
// "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */
}
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}
三、修改hvigorfile.ts文件
export { harTasks } from '@ohos/hvigor-ohos-plugin';