Search code examples
androidandroid-source

How to deal with the android BUILD_PREBUILT?


if I have a third part apk signed with their key.
I made it prebuilt with our device, in ics, this should be done with BUILD_PREBUILT, the apk must be signed with our key, but when the user get the device how could they upgrade the apk with the newest version the third part provided? (the certificates is not same).

Thanks in advance.


Solution

  • You have the option of not resigning the apk when using BUILD_PREBUILT by setting the LOCAL_CERTIFICATE := PRESIGNED

    Here is a full example of a makefile for this kind of use:

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE := MyApp
    LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
    LOCAL_MODULE_CLASS := APPS
    LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
    LOCAL_MODULE_TAGS := optional
    # tell dexopt not to try resigning the apks
    LOCAL_CERTIFICATE := PRESIGNED
    
    include $(BUILD_PREBUILT)