APK签名

有时候需要将最新编译的APK更新到系统中,可是更新之后不起效,原来是签名惹的祸。

签名需要的工具是signapk.jar,由/platform/build/tools/signapk/编译产生,编译完成后在/out/host/linux-x86/framework/中可以找到。

另外的公钥私钥在platform.pk8 platform.x509.pem等签名文件位于platform/build/target/product/security/中。

命令如下:

java -jar signapk.jar platform.x509.pem platform.pk8 my-unsigned.apk my.apk
上面命令中,使用platform权限签名。当然还有其他的权限,在 build/target/product/security/目录下的README文件描述如下:


The following standard test keys are currently included:

testkey -- a generic key for packages that do not otherwise specify a key.
platform -- a test key for packages that are part of the core platform.
shared -- a test key for things that are shared in the home/contacts process.
media -- a test key for packages that are part of the media/download system.

These test keys are used strictly in development, and should never be assumed
to convey any sort of validity.  When $BUILD_SECURE=true, the code should not
honor these keys in any context.


具体使用testkey、platform、shared、media签名中的哪一个,需要找到该APK的代码目录,在Android.mk文件中有个属性

LOCAL_CERTIFICATE := platform
如果没有在Android.mk文件中找到该属性,那就默认用testkey来签名。


签过名的APK就可以使用

adb push my.apk /system/app/


命令更新APP了。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值