欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

A33 Android4.4 预装自己的APK

程序员文章站 2022-06-23 08:46:28
平台:A33 Android4.4预装的apk名:Louhn.apk步骤:1.在astar_y3.mk添加PRODUCT_PACKAGES--- a/android4.4/device/softwinner/astar-y3/astar_y3.mk+++ b/android4.4/device/softwinner/astar-y3/astar_y3.mk@@ -14,6 +14,12 @@ PRODUCT_PROPERTY_OVERRIDES += \ # google piny....

平台:A33 Android4.4 

预装的apk名:Louhn.apk

步骤:

1.在astar_y3.mk添加PRODUCT_PACKAGES

--- a/android4.4/device/softwinner/astar-y3/astar_y3.mk
+++ b/android4.4/device/softwinner/astar-y3/astar_y3.mk
@@ -14,6 +14,12 @@ PRODUCT_PROPERTY_OVERRIDES += \
 # google pinyin
 PRODUCT_PACKAGES += GooglePinyin
 

+PRODUCT_PACKAGES += Louhn
 # init.rc, kernel
 ##	device/softwinner/astar-y3/media/bootanimation.zip:system/media/bootanimation.zip 
 ##	device/softwinner/astar-y3/media/boot.wav:system/media/boot.wav 

2.把Louhn.apk放到/device/softwinner/polaris-common/prebuild/apk/目录下,并修改Android.mk

Android.mk几个关键地方说明

LOCAL_MODULE := Louhn                                        apk名字

LOCAL_MODULE_TAGS:= optional                           模式选择,user、eng、tests、optional,这里选择optional就行,表示在任意模式下都能把该apk打包到system.img里

LOCAL_MODULE_PATH := $(TARGET_OUT)/app    选择apk的方式路径,选择$(TARGET_OUT)/app表示该apk放到/system/app目录下,这样用户就无法删除该apk,如果想让用户能够删除apk,只要把这段配置删除就行

LOCAL_REQUIRED_MODULES := libserial_port       libserial_port为添加的so库,由于我的apk只用到一个so库,所以这里只添加了一个名字。如果apk有多个so库,就要追加多个名字。具体的so库的名字,可以解压你的apk,在压缩文件里的lib->armeabi目录下查看

--- a/android4.4/device/softwinner/polaris-common/prebuild/apk/Android.mk
+++ b/android4.4/device/softwinner/polaris-common/prebuild/apk/Android.mk
@@ -17,6 +17,19 @@
 
 LOCAL_PATH := $(call my-dir)
 
+######add by louhn#########
+include $(CLEAR_VARS)
+LOCAL_MODULE := Louhn
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := APPS
+LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
+LOCAL_CERTIFICATE := PRESIGNED
+LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
+LOCAL_MODULE_PATH := $(TARGET_OUT)/app
+LOCAL_REQUIRED_MODULES := libserial_port
+include $(BUILD_PREBUILT)
+
+
 ################################################################################
 include $(CLEAR_VARS)
 LOCAL_MODULE := 4KPlayer

3.将2步骤解压出来的so文件放到device/softwinner/polaris-common/prebuild/apklib/目录下,并修改同级目录下的Android.mk文件,添加对应的so库

diff --git a/android4.4/device/softwinner/polaris-common/prebuild/apklib/Android.mk b/android4.4/device/softwinner/polaris-common/prebuild/apklib/Android.mk
index 1378a7e81e..2932706762 100755
--- a/android4.4/device/softwinner/polaris-common/prebuild/apklib/Android.mk
+++ b/android4.4/device/softwinner/polaris-common/prebuild/apklib/Android.mk
@@ -31,5 +31,7 @@ LOCAL_PREBUILT_LIBS := libgnustl_shared.so \
                        libjni_googlepinyinime_latinime_5.so \
                        libjni_hmm_shared_engine.so \
                        libpinyin_data_bundle.so \
-					   libnoise_generator.so
+		       libnoise_generator.so \
+		       libserial_port.so
+
 include $(BUILD_MULTI_PREBUILT)
diff --git a/android4.4/device/softwinner/polaris-common/prebuild/apklib/libserial_port.so b/android4.4/device/softwinner/polaris-common/prebuild/apklib/libserial_port.so
new file mode 100644
index 0000000000..4eea035115
Binary files /dev/null and b/android4.4/device/softwinner/polaris-common/prebuild/apklib/libserial_port.so differ

 

本文地址:https://blog.csdn.net/Mrdeath/article/details/111034524

相关标签: A33_Android