An Android.mk file to add an .apk to /system/priv-app


I am building the Android Open Source Project (AOSP) from source for the Pine 64 board using the community v6 version.  One of the things I needed to do was add a pre-compiled .apk file to the /system/priv-app folder.  Finding information on how to create an Android.mk file to do that was really difficult.  Below is the Android.mk file that I finally came up with.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# Module name should match apk name to be installed.
LOCAL_MODULE := MyModule
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)

LOCAL_PACKAGE_NAME := MyModule
LOCAL_CERTIFICATE := shared
LOCAL_PRIVILEGED_MODULE := true

# If its a launcher / home App (which mine is) set this
LOCAL_OVERRIDES_PACKAGES := Home

include $(BUILD_PREBUILT)

Leave a comment