当前位置:   article > 正文

HarmonyOS 踩坑日记(1)_error: failed :entry:default@compilearkts...

error: failed :entry:default@compilearkts...

模块引入子模块报 

> 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模块类型:

  1. {
  2. "module": {
  3. "name": "XygjProvinceCard",
  4. "type": "har",
  5. "description": "$string:module_desc",
  6. "deviceTypes": [
  7. "phone",
  8. "tablet",
  9. "2in1"
  10. ],
  11. "installationFree": false,
  12. }
  13. }

二、build-profile.json5去掉entryModules

  1. {
  2. "apiType": "stageMode",
  3. "buildOption": {
  4. "arkOptions": {
  5. // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */
  6. }
  7. },
  8. "buildOptionSet": [
  9. {
  10. "name": "release",
  11. "arkOptions": {
  12. "obfuscation": {
  13. "ruleOptions": {
  14. "enable": true,
  15. "files": [
  16. "./obfuscation-rules.txt"
  17. ]
  18. }
  19. }
  20. }
  21. },
  22. ],
  23. "targets": [
  24. {
  25. "name": "default"
  26. },
  27. {
  28. "name": "ohosTest",
  29. }
  30. ]
  31. }

三、修改hvigorfile.ts文件

export { harTasks } from '@ohos/hvigor-ohos-plugin';

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/82315
推荐阅读
相关标签
  

闽ICP备14008679号