不老刘
不老刘
  • 发布:2025-01-17 09:17
  • 更新:2025-01-17 14:26
  • 阅读:217

vue3发布成鸿蒙,打包始终失败

分类:鸿蒙Next

09:15:27.170 开始制作安装包 .app,请耐心等待 .....
09:15:30.365 > hvigor ERROR: SDK component missing. Please verify the integrity of your SDK.

hvigor ERROR: BUILD FAILED in 1 s 865 ms
09:15:30.365 安装包制作失败


很多问题都可以在这里找到答案,

我最终打包失败,大概率是vue2转到vue3的代码有问题。我试了用vue3版本打安卓包,也不能用。。。
还是等vue3打安卓没问题后,再尝试打鸿蒙吧!

2025-01-17 09:17 负责人:无 分享
已邀请:
不老刘

不老刘 (作者)

build-profile.json5

{  
  "app": {  
    "signingConfigs": [  
      {  
        "name": "default",  
        "type": "HarmonyOS",  
        "material": {  

        }  
      },  
      {  
        "name": "release",  
        "type": "HarmonyOS",  
        "material": {  

        }  
      }  
    ],  
    "products": [  
      {  
        "name": "default",  
        "signingConfig": "default",  
        "compatibleSdkVersion": "5.0.0(12)",  
        "runtimeOS": "HarmonyOS",  
        "targetSdkVersion": "5.0.0(12)",  
        "bundleType": "app",  
        // 修改为允许的值之一  
        "versionCode": 1,  
        "versionName": "1.0.0",  
        "output": {  
          // 修改为对象并添加 artifactName 属性  
          "artifactName": "default.hap"  
        },  
        "arkTSVersion": "1.0",  
        // 修改为允许的值之一  
        "vendor": "",  
        "bundleName": ""  
      },  
      {  
        "name": "release",  
        "signingConfig": "release",  
        "compatibleSdkVersion": "5.0.0(12)",  
        "runtimeOS": "HarmonyOS",  
        "compileSdkVersion": "5.0.0(12)",  
        "targetSdkVersion": "5.0.0(12)",  
        "bundleType": "app",  
        // 修改为允许的值之一  
        "versionCode": 1,  
        "versionName": "1.0.0",  
        "output": {  
          // 修改为对象并添加 artifactName 属性  
          "artifactName": "release.hap"  
        },  
        "arkTSVersion": "1.0",  
        // 修改为允许的值之一  
        "vendor": "",  
        "bundleName": ""  
      }  
    ],  
    "buildModeSet": [  
      {  
        "name": "debug"  
      },  
      {  
        "name": "release"  
      }  
    ]  
  },  
  "modules": [  
    {  
      "name": "entry",  
      "srcPath": "./entry",  
      "targets": [  
        {  
          "name": "default",  
          "applyToProducts": [  
            "default",  
            "release"  
          ]  
        }  
      ]  
    }  
  ]  
}
不老刘

不老刘 (作者)

解决办法:

你可能声明了不兼容的字段,需要在 harmony-mp-configs/build-profile.json5 里面去掉 app.products.*.compileSdkVersion 属性

马上又遇到新问题了。。。

ERROR: Bytecode HARs: [@uni_modules/uni-payment-alipay, @dcloudio/uni-app-runtime, @uni_modules/hmr-for-uni-app] not supported when useNormalizedOHMUrl is not true.

  • Try the following:

    Please check useNormalizedOHMUrl in the project-level build-profile.json5 file.

hvigor ERROR: Failed :entry:default@GenerateLoaderJson...
hvigor ERROR: BUILD FAILED in 3 s 66 ms

解决方法:

在上面那个文件products节点里增加

"buildOption": {
"strictMode": {
"caseSensitiveCheck": true,
"useNormalizedOHMUrl": true
}
}

不老刘

不老刘 (作者)

又遇到新问题了

hvigor ERROR: Failed :entry:default@SignHap...
hvigor ERROR: BundleName in the project configuration does not match that in the SigningConfigs.
Detail: Open the project-level build-profile.json5 file. Change the bundleName value
to that in the SigningConfigs. Otherwise, go to the app.json5 file and change the bundleName value there.

不老刘

不老刘 (作者)

上面问题只要保证所有模式都bundlename都一致即可。

14:24:47.910 安装鸿蒙工程的依赖 ...
14:24:49.328 安装鸿蒙工程依赖成功
14:24:49.328 开始制作安装包 .app,请耐心等待 ....................
14:25:16.116 安装包制作失败

这下彻底无解了,连个失败的理由都没有

要回复问题请先登录注册