鸿蒙第一次打包发布证书别名问题记录

0 阅读1分钟

发布证书别名问题

ERROR: 11014001 key alias not found Error Message: KeyAlias {appname} is not exist in {appname.p12}

问题原因

Key Alias 配置错误 :build-profile.json5 中配置的 key alias 是 xxx ,但实际证书中的别名是 xxx (全小写)

解决方式

修改json5配置、更新证书的路径:

// build-profile.json5
{
  "material": {
    "keyAlias": "appname",  
    // ...
  }
}
"profile": "/Users/username/xxx.p7b",
"certpath": "/Users/username/xxx.cer"

我的尝试

1:错误: KeyAlias {appname} is not exist in {appname.p12},解决:修正 key alias

2:错误: signature verification failed due to not trusted app source,原因:发布签名的应用无法直接安装到测试设备,解决:添加 debug 签名配置用于开发

3.错误: No HAP found for the APP,原因:构建配置缺少 targets 配置,解决:在 build-profile.json5 中添加正确的 targets 配置

4.错误:再次出现 key alias 错误,解决:最终确认所有配置正确,更新 profile 路径

关键要点

  1. Key Alias 必须完全匹配 :包括大小写
  2. 证书路径要正确 :确保所有证书文件路径正确
  3. 开发时用 debug 签名 :避免 "signature verification failed" 错误
  4. 发布时用 default 签名 :要使用正式发布证书