You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android应用运行失败:debug.keystore格式无效致打包错误

解决Android构建报错:Invalid keystore format(无法读取debug.keystore)

构建Android应用时出现如下报错:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageDebug'.
> Failed to read key AndroidDebugKey from store "C:\Users\Acer\.android\debug.keystore": Invalid keystore format

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Finished with error: Gradle task assembleDebug failed with exit code 1

这是默认debug密钥库文件损坏、格式无效导致的,以下是可行的解决步骤:

  • 删除损坏的debug.keystore文件
    定位到路径C:\Users\Acer\.android\debug.keystore,直接删除该文件。下次构建项目时,Android Studio会自动生成一个全新的、格式正确的debug密钥库。

  • 清理并重新构建项目
    在Android Studio中依次执行Build -> Clean Project,然后Build -> Rebuild Project,确保项目缓存被彻底清理,使用新生成的密钥库完成构建。

  • 验证密钥库有效性(可选)
    若想确认新密钥库正常,可使用keytool命令检查(需确保Java环境变量已配置,keytool可直接调用):

    keytool -list -v -keystore C:\Users\Acer\.android\debug.keystore -alias AndroidDebugKey -storepass android -keypass android
    

    命令执行后能正常输出密钥的详细信息,就说明问题已解决。

内容的提问来源于stack exchange,提问作者Adam Elvandi Yusup

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 19:14:52