LineageOS18.1內建第三方應用APK
阿新 • • 發佈:2022-03-06
前置條件:需要repo 出完整的版本原始碼。
以百度輸入法為例。
將百度輸入法apk檔案命名為baidushuru.apk,那麼在${lineageos_source_code}/packages/apps/
目錄下新建一個baidushuru
目錄。並將baidushuru.apk放於此目錄下。並新建Android.mk
檔案,並將baidushuru.apk檔案中的lib目錄放置於此目錄下。如圖:
其中Android.mk
檔案內容如下:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := baidushuru LOCAL_MODULE_TAGS := optional LOCAL_CERTIFICATE := PRESIGNED LOCAL_SRC_FILES := baidushuru.apk LOCAL_MODULE_CLASS := APPS #LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) LOCAL_MODULE_SUFFIX := .apk #LOCAL_BUILT_MODULE_STEM := package.apk LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/app #LOCAL_MODULE_PATH := $(TARGET_OUT)/app #LOCAL_DEX_PREOPT := false LOCAL_PREBUILT_JNI_LIBS := \ @lib/armeabi-v7a/libBaiduSpeechSDK.so \ @lib/armeabi-v7a/libbdinput_gif_v1_0_10.so \ @lib/armeabi-v7a/libchiperencoder_v1_2_1.so \ @lib/armeabi-v7a/libfire.so \ @lib/armeabi-v7a/libime_graphics.so \ @lib/armeabi-v7a/libmiuiblursdk.so \ @lib/armeabi-v7a/libp.so \ @lib/armeabi-v7a/libQt.so \ @lib/armeabi-v7a/librsjni.so \ @lib/armeabi-v7a/libRSSupport.so \ @lib/armeabi-v7a/libsimeji_ime.so \ @lib/armeabi-v7a/libvad.dnn.so \ @lib/armeabi-v7a/libxcrash.so \ @lib/armeabi-v7a/libxcrash_dumper.so \ @lib/armeabi-v7a/libyoga.so \ @lib/arm64-v8a/libBaiduSpeechSDK.so \ @lib/arm64-v8a/libbdinput_gif_v1_0_10.so \ @lib/arm64-v8a/libchiperencoder_v1_2_1.so \ @lib/arm64-v8a/libfire.so \ @lib/arm64-v8a/libime_graphics.so \ @lib/arm64-v8a/libmiuiblursdk.so \ @lib/arm64-v8a/libp.so \ @lib/arm64-v8a/libQt.so \ @lib/arm64-v8a/librsjni.so \ @lib/arm64-v8a/libRSSupport.so \ @lib/arm64-v8a/libsimeji_ime.so \ @lib/arm64-v8a/libvad.dnn.so \ @lib/arm64-v8a/libxcrash.so \ @lib/arm64-v8a/libxcrash_dumper.so \ @lib/arm64-v8a/libyoga.so \ include $(BUILD_PREBUILT)
LOCAL_PREBUILT_JNI_LIBS
引數為lib檔案下的所有so名。我在弄內建微信時發現微信apk的so賊多,我寫了個指令碼方便直接複製貼上。
from array import array from os import walk mypath = "lib_path" filenames = next(walk(mypath), (None, None, []))[2] array = [] for i in filenames: # for armv7 string = " @lib/armeabi-v7a/" + i + " \\" array.append(string) pass for i in array: print(i)