Android Source Code contains the APK file containing the so file, androidapk
Method 1:
1 include $(CLEAR_VARS) 2 # Module name should match apk name to be installed 3 LOCAL_MODULE := Test 4 LOCAL_MODULE_TAGS := optional 5 LOCAL_SRC_FILES := $(LOCAL_MODULE).apk 6 LOCAL_MODULE_CLASS := APPS 7 LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 8 LOCAL_PREBUILT_JNI_LIBS := \ 9 @lib/armeabi/libtest.so \10 @lib/armeabi/libtest2.so11 LOCAL_CERTIFICATE := PRESIGNED12 include $(BUILD_PREBUILT)
InLOCAL_PREBUILT_JNI_LIBS
.
If the so file is 32-bit and the source code is for 64 machines, you must addLOCAL_MULTILIB := 32
.
In the current directory of the APK file, runmm
Command to compile the current module. The APK and so files will be installedout/target/product/xxx/system/app/Test/
Andout/target/product/magc6735_66t_l1/system/app/MonitorS09/lib/arm
. Then usemake snod
Command to repackage system. img.
4. If you need to include the Test module when re-building the entire project, open the filedevice\mediatek\common\device.mk
To add Test to PRODUCT_PACKAGES.PRODUCT_PACKAGES += Test
Note: If the APP uses the System-Level permission, you must preset it under/system/priv-app (originally in/system/app ). Modify Android. mk and addLOCAL_PRIVILEGED_MODULE := true
To declare that the app must be placed under/system/priv-app.
Method 2:
The following script is a built-in sogou Input Method routine. This apk contains three so files: libhanvonhw_v39.so, libsogouime_jni_v39.so, and libthemeextractor_v39.so.
The content of Android. mk is as follows:
1 LOCAL_PATH := $(call my-dir) 2 3 include $(CLEAR_VARS) 4 5 # Module name should match apk name to be installed 6 LOCAL_MODULE := SogouInput 7 8 LOCAL_MOUDLE_TAGS := optional 9 10 LOCAL_SRC_FILES := $(LOCAL_MODULE).apk 11 12 LOCAL_MODULE_CLASS := APPS 13 14 LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 15 16 LOCAL_CERTIFICATE := PRESIGNED 17 18 LOCAL_REQUIRED_MODULES := \ 19 libhanvonhw_v39 \ 20 libsogouime_jni_v39 \ 21 libthemeextractor_v39 22 23 include $(BUILD_PREBUILT) 24 25 ######################################### 26 include $(CLEAR_VARS) 27 28 LOCAL_PREBUILT_LIBS := libhanvonhw_v39.so 29 30 LOCAL_MODULE_TAGS := optional 31 32 include $(BUILD_MULTI_PREBUILT) 33 ######################################### 34 include $(CLEAR_VARS) 35 36 LOCAL_PREBUILT_LIBS := libsogouime_jni_v39.so 37 38 LOCAL_MODULE_TAGS := optional 39 40 include $(BUILD_MULTI_PREBUILT) 41 ######################################### 42 include $(CLEAR_VARS) 43 44 LOCAL_PREBUILT_LIBS := libthemeextractor_v39.so 45 46 LOCAL_MODULE_TAGS := optional 47 48 include $(BUILD_MULTI_PREBUILT) 49 ##########################################
Finally, do not forget to add the SogouInput module to PRODUCT_PACKAGES: = in $ (ANDROID_ROOT)/build/target/product/common. mk.