直接上命令:
java -Djava.library.path=prebuilts/sdk/tools/linux/lib64/ -jar out/host/linux-x86/framework/signapk.jar build/target/product/security/platform.x509.pem build/target/product/security/platform.pk8 test.apk test_signed.apk
说明:
1. -Djava.library.path=prebuilts/sdk/tools/linux/lib64/ 的作用,指明 libconscrypt_openjdk_jni.so坐在的路径,否则签名时会报如下错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no conscrypt_openjdk_jni in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1871)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1124)
at org.conscrypt.NativeCryptoJni.init(NativeCryptoJni.java:25)
at org.conscrypt.NativeCrypto.<clinit>(NativeCrypto.java:54)
at org.conscrypt.OpenSSLBIOInputStream.<init>(OpenSSLBIOInputStream.java:34)
2.signapk.jar的路径在源码环境下为:out/host/linux-x86/framework/signapk.jar
3.平台签名文件platform.x509.pem 和platform.pk8 在源码路径:build/target/product/security/
4.当然,如果你把上述文件收集到一个录了,只需要把上述路径相对路径到一个路径下也可以。