apk签名
使用工具命令
找到签名工具
android/prebuilts/sdk/tools/lib/signapk.jar
out/host/linux-x86/framework/signapk.jar
执行:
java -jar signapk.jar platform.x509.pem platform.pk8 unsignDemo.apk signedDemo.apk
或者直接在android源码编译环境执行
java -jar out/host/linux-x86/framework/signapk.jar build/target/product/security/platform.x509.pem build/target/product/security/platform.pk8 input.apk output.apk
指定library
java -Djava.library.path=“out/host/linux-x86/lib64” -jar out/host/linux-x86/framework/signapk.jar build/target/product/security/platform.x509.pem build/target/product/security/platform.pk8 Unsigned.apk signed.apk
mm编译
platform签名:
AndroidManifest.xml的manifest节点中添加 android:sharedUserId=”android.uid.system”,
Android.mk中增加 LOCAL_CERTIFICATE := platform
shared签名:
AndroidManifest.xml的manifest节点中增加android:sharedUserId=”android.uid.shared”,
Android.mk中增加LOCAL_CERTIFICATE := shared
media签名:
AndroidManifest.xml的manifest节点中增加 android:sharedUserId=”android.media”,
Android.mk中增加 LOCAL_CERTIFICATE := media
不再进行签名:
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_PATH := $(call my-dir)
##------------------copy apps to system/app--------------------------##
include $(CLEAR_VARS)
APPS := $(notdir $(wildcard $(LOCAL_PATH)/*.apk))
APP_NAME := $(basename $(APPS))
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE :=$(APP_NAME)
LOCAL_SRC_FILES := $(APPS)
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := platform
include $(BUILD_PREBUILT)
查看签名信息
jarsigner -verify -verbose -certs *.apk