Unity打包出现a failure occurred while executing 解决办法

今天做项目打包Unity为apk时,跳出:a failure occurred while executing com.android.build.gradle.internal.tasks. Workers$ActionFacade See the Consle for details

核心报错信息为:

com.android.ide.common.signing.KeytoolException:
Failed to read key AndroidDebugKey from store
"C:\Users\21772\.android\debug.keystore":
Invalid keystore format

这说明 Unity 在给 APK 做 debug 签名时读取 keystore 失败,原因是:
debug.keystore 文件损坏或格式不正确
这不是 Unity、Gradle 或 Android SDK 的问题,而是 本地 debug.keystore 文件坏了。

解决方法

  • 1.删除损坏的 keystore
    打开目录:C:\Users\21772\.android\
    删除文件:debug.keystore
    只删除这一个文件即可。
  • 2.重新打包
    回到 Unity:
    File
    → Build Settings
    → Build
    Gradle 会 自动重新生成新的 debug.keystore。

通常第一次重新生成时会看到日志类似:
Creating new debug keystore
然后 APK 就能正常打包。

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐