我正在尝试使用 Gradle签名插件 对Android AAR构件进行签名。不幸的是,在此过程中我遇到了一个无法解释的 NullPointerException
错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':library:signArchives'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':library:signArchives'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
[...snip...]
at org.gradle.launcher.Main.main(Main.java:37)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.lang.NullPointerException
at org.bouncycastle.openpgp.PGPSignatureGenerator.initSign(Unknown Source)
at org.bouncycastle.openpgp.PGPSignatureGenerator.initSign(Unknown Source)
at org.bouncycastle.openpgp.PGPSignatureGenerator$initSign.call(Unknown Source)
at org.gradle.plugins.signing.signatory.pgp.PgpSignatory.createSignatureGenerator(PgpSignatory.groovy:54)
at org.gradle.plugins.signing.signatory.pgp.PgpSignatory.sign(PgpSignatory.groovy:64)
[...snip...]
... 52 more
BUILD FAILED
最简单的调试异常的方法是什么?有没有办法将调试器附加到gradle上?我可以构建签名插件,插入一些日志语句,并告诉我的构建使用我的自定义版本而不是它提供的版本吗?
gpg --sign
手动签名并验证它。同时,使用 Maven 的签名插件也能够正常工作。 - passy