Skip to content

Android Preinstall APK

This section describes how to preinstall an APP as a system APP.

File Paths

Main Control Models Compilation Configuration Path APP Preinstallation Path
A133 K5/K5C android/device/softwinner/ceres-c3/ceres_c3.mk android/vendor/aw/homlet/prebuild/
H618 K2B/K2C vendor/aw/homlet/homlet.mk vendor/aw/public/prebuild/
RK3562/RK3568/RK3576/RK3588 K1/K1B/K3/K7/K7C/K8 device/rockchip/common/device.mk vendor/rockchip/common/apps/

Example: Preinstalling TestLauncher APK

  1. Create a TestLauncher directory under the APP Preinstallation Path, and place the Android.mk and APK files inside it.
ls TestLauncher/
Android.mk
TestLauncher.apk
  1. Add a configuration with the module name TestLauncher in the Compilation Configuration Path:

Tip

The module name corresponds to the module name in the mk file.

+PRODUCT_PACKAGES += \
+       TestLauncher

Android.mk File Example

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := platform

LOCAL_MODULE := TestLauncher
LOCAL_SRC_FILES := TestLauncher.apk

include $(BUILD_PREBUILT)

Note

Command Explanation: LOCAL_PATH := $(call my-dir): Sets the path of the current module.
include $(CLEAR_VARS): Clears previously defined variables to avoid interference with the current module.
LOCAL_MODULE_TAGS := optional: Marks the module as optional.
LOCAL_MODULE_CLASS := APPS: Specifies the module category as an application.
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX): Uses the standard APK suffix.
LOCAL_CERTIFICATE := platform: Uses platform signature.
LOCAL_MODULE := TestLauncher: Module name.
LOCAL_SRC_FILES := TestLauncher.apk: Specifies the APK file path.
include $(BUILD_PREBUILT): Uses the prebuilt build method.
LOCAL_PRIVILEGED_MODULE := true: This installs the application to the /system/priv-app directory, granting more system permissions.