1. Introduction

Recently, I have been studying Android system development. During the development process, I may need to integrate three-party APK into the system. There are two approaches that I know of so far.

  1. One way is to put the tripartite APK file under the system directory after the system is compiled. For details, see How to update apK files to the vendor folder in the system.
  2. Another option is to package a tripartite APK file into the Android system at compile time.

2. System compilation

  1. First create a directory under Android system directory XXX\ Packages \apps. For example, APP_NAME (APP_NAME can be replaced with the file name of its own integrated third-party APK). Then place the APP_NAME. Apk file and android. mk file to be integrated in this directory. The directory structure is as follows:

    APP_NAME: APP_NAME apk Android. MkCopy the code
  2. Write an Android.mk file.

    LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := APP_NAME LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES  := APP_NAME.apk LOCAL_MODULE_CLASS := APPS LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) LOCAL_CERTIFICATE :=  platform include $(BUILD_PREBUILT)Copy the code
  3. Verify that you can compile into the system. Of course, compiling the system every time can take a lot of time. We can select a single module to compile.

    Build /envsetup.sh XXX $lunch [your Project_Name] XXX $CD packages/apps/APP_NAME/ XXX /packages/apps/APP_NAME$mmCopy the code

    If #### build completed successfully (xx:xx (mm:ss)) #### is displayed, the configuration is correct. You can recompile the system test end case.