gpt4 book ai didi

java - jarsigner 返回 NullPointerException 错误

转载 作者:行者123 更新时间:2023-11-29 23:52:14 25 4
gpt4 key购买 nike

我有一个 cordova 应用程序,我正在使用 cmd 来构建它,并且需要签署它的发布 apk。

首先,我在没有使用 -tsa 选项的情况下执行此操作,因此在运行命令时它会询问密码,然后签署了警告:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 
-keystore my.keystore "apk\release\app-release-unsigned.apk" myaliasofkeystore

No -tsa or -tsacert is providedand this jar is not timestamped.

所以我添加了选项 -tsa timestamp.digicert.com :

jarsigner -tsa timestamp.digicert.com -verbose -sigalg SHA1withRSA -digestalg SHA1 
-keystore my.keystore "apk\release\app-release-unsigned.apk" myaliasofkeystore

现在,在运行这个命令时它要求输入密码 但在那之后会产生这个错误:

jarsigner error: java.lang.NullPointerException

最佳答案

您不需要添加 -tsa。忽略这个关于时间戳的警告。

根据 docs :

Time stamping the signature is recommended, and a warning is shown if the signature is not time stamped. The time stamp is used to verify that the certificate used to sign the JAR file was valid at the time of signing.

这意味着在证书过期后,用户可以确信您已经在过期日之前签署了您的 APK。但是根据google docs :

If you plan to publish your apps on Google Play, the key you use to sign those APKs must have a validity period ending after 22 October 2033. Google Play enforces this requirement to ensure that users can seamlessly upgrade apps when new versions are available.

如果您的用户无法在 2033 年 10 月 23 日验证证书,我认为这不是什么大问题:)

关于java - jarsigner 返回 NullPointerException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50781472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com