主模块引入子模块报
> 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文章来源:https://www.toymoban.com/news/detail-755192.html
{
"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文件文章来源地址https://www.toymoban.com/news/detail-755192.html
export { harTasks } from '@ohos/hvigor-ohos-plugin';
到了这里,关于HarmonyOS 踩坑日记(1)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!