安卓:构建平台源后,如何签署任意APK与平台的关键?平台、关键、APK

2023-09-13 02:31:06 作者:相关个性七字推荐

作为一个实验,我想用我的定制Android平台的平台密钥签署任意APK,即通过NDK建成。过程是怎样的去这样做呢?

As an experiment, I would like to use the platform key of my custom built Android platform to sign an arbitrary APK, that is built via the NDK. What is the process to go about doing this?

推荐答案

如果你有你的平台密钥/证书对(.pk8 + x509.pem)。它可以在编译/目标/产品/安在pulbic SDK中找到。

If you have your platform key/certificate pair (.pk8 + x509.pem). Which can be found under build/target/product/security in the pulbic sdk.

您可以使用SignApk.jar在命令行

You can use the SignApk.jar from the command line

Java的罐子SignApk.jar   platform.x509.pem platform.pk8   Application.apk Application_signed.apk

java -jar SignApk.jar platform.x509.pem platform.pk8 Application.apk Application_signed.apk

或者使自动化更容易,你可以导入密钥/证书对到你的Java密钥存储文件,使用密钥工具 - importkeypair ,并使用Ant生成文件或Eclipse进行签名。

Or to make automation easier, you can import the key/cert pair into your java keystore file, with the keytool-importkeypair, and use an ant makefile or eclipse for signing.

密钥工具,importkeypair -k   〜/ .android / debug.keystore -p机器人   -pk8 platform.pk8 -cert platform.x509.pem -alias平台

keytool-importkeypair -k ~/.android/debug.keystore -p android -pk8 platform.pk8 -cert platform.x509.pem -alias platform