DevEco Studio 新建DEMO后运行,出现 Invalid keystore format

DevEco Studio 新建DEMO后运行,出现 Invalid keystore format

用开发者工具新建的项目,配置好环境后,模拟器也启动了,运行项目时一直报错,求助!!!

Failed to load signer "signer #1"
java.io.IOException: Invalid keystore format

    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:650)
    at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
    at java.security.KeyStore.load(KeyStore.java:1433)
    at com.android.apksigner.SignerParams.loadKeyStoreFromFile(SignerParams.java:353)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:239)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
    at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:277)
    at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:83)

> Task :entry:signDebugShell FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':entry:signDebugShell'.

> Sign shell failed. For details, see the log.

11 回复

问题一样,暂时没法解决


可能是jdk版本的原因,本地有jdk1.8,下载sdk的时候又下载了一遍。

亲爱滴开发者~~目前开源的鸿蒙不支持现在的GT手表。

根据文档的教程(链接)运行hello world,出现的错误,不是在真机上跑的。新建的项目运行起来就有这个问题,看了是部分人的电脑会出现,到现在也没解决。

没找到签名文件,一般debug的时候是不用签名的,启动命令没配置对。

Executing tasks: [:entry:assembleDebug], 是确实的debug,而且直接IDE新建的demo,没改过任何东西。

Gradle Daemon started in 6 s 142 ms

> Configure project :
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\java\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\js\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\native\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\previewer\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\toolchains\uni-package.json

> Configure project :entry
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\java\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\js\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\native\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\previewer\3.0.0.80\uni-package.json
Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\toolchains\uni-package.json

> Task :entry:preBuild
> Task :entry:compileDebugIdl
> Task :entry:collectDebugDependencies
> Task :entry:mergeDebugResources
> Task :entry:mergeDebugProfile
> Task :entry:compileDebugResources
> Task :entry:compileDebugRFile
> Task :entry:processDebugJavaResource
> Task :entry:compileDebugJavaWithJavac
> Task :entry:generateDebugJsManifest
> Task :entry:compileDebugJsWithNodeJs
> Task :entry:compileDebugNativeWithCmake
> Task :entry:mergeDebugJavaResource
> Task :entry:generateDebugClassesJar
> Task :entry:mergeDebugProjectDex
> Task :entry:generateDebugShell
> Task :entry:processDebugShellManifest
> Task :entry:compileDebugShellResources
> Task :entry:linkDebugShellResources
> Task :entry:compileDebugShellJavaWithJavac
> Task :entry:mergeDebugShellDex
> Task :entry:packageDebugShell UP-TO-DATE
> Task :entry:packageDebugSimplifyShell UP-TO-DATE
> Task :entry:validateDebugSigning
Failed to load signer "signer #1"
java.io.IOException: Invalid keystore format
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:650)
    at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
    at java.security.KeyStore.load(KeyStore.java:1433)
    at com.android.apksigner.SignerParams.loadKeyStoreFromFile(SignerParams.java:353)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:239)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
    at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:277)
    at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:83)

> Task :entry:signDebugShell FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':entry:signDebugShell'.
> Sign shell failed. For details, see the log.

* 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 20s
25 actionable tasks: 23 executed, 2 up-to-date

试了下,初始的Wearable项目,能够正常启动,可能是bug,毕竟beta版…

直接双击entry下的assembleDebug,执行结果如下:

Configure project :entry Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\java\3.0.0.80\uni-package.json Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\js\3.0.0.80\uni-package.json Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\native\3.0.0.80\uni-package.json Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\previewer\3.0.0.80\uni-package.json Info: Parsing C:\Users\Administrator\AppData\Local\Huawei\Sdk\toolchains\uni-package.json

Task :entry:preBuild Task :entry:compileDebugIdl Task :entry:collectDebugDependencies Task :entry:mergeDebugResources Task :entry:mergeDebugProfile Task :entry:compileDebugResources Task :entry:compileDebugRFile Task :entry:processDebugJavaResource Task :entry:compileDebugJavaWithJavac Task :entry:generateDebugJsManifest Task :entry:compileDebugJsWithNodeJs Task :entry:compileDebugNativeWithCmake Task :entry:mergeDebugJavaResource Task :entry:generateDebugClassesJar Task :entry:mergeDebugProjectDex Task :entry:generateDebugShell Task :entry:processDebugShellManifest Task :entry:compileDebugShellResources Task :entry:linkDebugShellResources Task :entry:compileDebugShellJavaWithJavac Task :entry:mergeDebugShellDex Task :entry:packageDebugShell UP-TO-DATE Task :entry:packageDebugSimplifyShell UP-TO-DATE Task :entry:validateDebugSigning Task :entry:signDebugShell Task :entry:packageDebugHap Task :entry:signDebugHap Task :entry:assembleDebug

BUILD SUCCESSFUL in 10s

28 actionable tasks: 26 executed, 2 up-to-date

15:51:54: Task execution finished ‘assembleDebug’.

有要学HarmonyOS AI的同学吗,联系我:https://www.itying.com/goods-1206.html

亲爱滴开发者 ,这个问题已经在处理中啦,稍后答复你哟 ,么么哒

在DevEco Studio中新建DEMO后运行出现“Invalid keystore format”错误,通常是由于密钥库文件格式不兼容或损坏导致的。鸿蒙应用在签名时需要使用特定的密钥库文件(.p12或.jks格式),如果文件格式不正确或损坏,就会出现该错误。

解决方法包括:

  1. 检查密钥库文件是否使用正确的格式(.p12或.jks)。
  2. 确保密钥库文件未损坏,可以尝试重新生成或修复。
  3. 确认在DevEco Studio中配置的密钥库路径和密码正确无误。
  4. 如果使用第三方工具生成密钥库文件,确保工具支持生成符合要求的格式。

如果问题仍未解决,建议重新生成密钥库文件并重新配置签名信息。

`Invalid keystore format` 错误通常是由于密钥库文件格式不正确或损坏导致的。请检查以下步骤:

1. 确认密钥库文件路径:确保在 `build.gradle` 或 `config.json` 中配置的密钥库文件路径正确。
2. 检查密钥库文件:使用 `keytool -list -keystore your_keystore.jks` 命令验证密钥库文件是否有效。
3. 重新生成密钥库:如果文件损坏,重新生成一个新的密钥库文件,并更新相关配置。

确保所有配置正确后,重新编译运行项目。
回到顶部