android13预置apk

android 13 预置应用Android.mk文件编写

预安装安装位置

定义apk安装分区位置:system、system_ext、product、vendor、odm
1.安装在system/app
LOCAL_SYSTEM_MODULE := true

2.安装在system_ext/app
LOCAL_SYSTEM_EXT_MODULE := true

3.安装在product/app
LOCAL_PRODUCT_MODULE := true

4.安装在vendor/app
LOCAL_VENDOR_MODULE := true

5.安装在vendor/odm/app
LOCAL_ODM_MODULE := true

apk安装在上述分区的哪个文件夹内

1.安装在app文件夹内
LOCAL_PRIVILEGED_MODULE := false

2.安装在priv-app文件夹内
LOCAL_PRIVILEGED_MODULE := true

签名类型

1.使用系统签名
LOCAL_CERTIFICATE := platform

2.使用原apk签名
LOCAL_CERTIFICATE := PRESIGNED

完整示例

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_MODULE := AwCamera2
LOCAL_MODULE_TAGS := optional
LOCAL_BUILT_MODULE_STEM := package.apk

#指定apk安装文件夹
LOCAL_SYSTEM_MODULE := true
#LOCAL_SYSTEM_EXT_MODULE := true
#LOCAL_PRODUCT_MODULE := true
#LOCAL_VENDOR_MODULE := true
#LOCAL_ODM_MODULE := true

#安装在priv-app文件夹内
#LOCAL_PRIVILEGED_MODULE := true

LOCAL_MODULE_CLASS := APPS
LOCAL_SRC_FILES := AwCamera2.apk

#定义编译apk使用的签名类型
LOCAL_CERTIFICATE := platform
#LOCAL_CERTIFICATE := PRESIGNED

#要覆盖的模块名
#LOCAL_OVERRIDES_PACKAGES := Camera2 AWCamera

#可选
LOCAL_DEX_PREOPT := false
#解决mismatch in the <uses-library> tags between the build system and the manifest问题
#LOCAL_ENFORCE_USES_LIBRARIES := false

#定义apk依赖so位数与路径
#32位机器
#LOCAL_MULTILIB := 32
#LOCAL_PREBUILT_JNI_LIBS := $(sort $(shell cd $(LOCAL_PATH) ; find -L lib/armeabi-v7a -name "*.so"))
#64位机器
LOCAL_MULTILIB := 64
LOCAL_PREBUILT_JNI_LIBS := $(sort $(shell cd $(LOCAL_PATH) ; find -L lib/arm64-v8a -name "*.so"))
include $(BUILD_PREBUILT)

---- 方式二,20240924添加


LOCAL_PATH := $(call my-dir)
################################################################################
include $(CLEAR_VARS)
LOCAL_MODULE := AwCamera14
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
#LOCAL_PRIVILEGED_MODULE := true
#LOCAL_DEX_PREOPT := false
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_OVERRIDES_PACKAGES := Camera2 AWCamera
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_REPLACE_PREBUILT_APK_INSTALLED := $(LOCAL_PATH)/AwCamera14.apk

LOCAL_MULTILIB :=64
LOCAL_PREBUILT_JNI_LIBS := \
    @lib/arm64-v8a/ld-android.so \
    @lib/arm64-v8a/libMNN.so \
    @lib/arm64-v8a/libMNN_CL.so \
    @lib/arm64-v8a/libai-engine.so \
    @lib/arm64-v8a/libaw_smile_det.so \
    @lib/arm64-v8a/libaw_utilities_standalone.so \
    @lib/arm64-v8a/libawf_align_v1.1.so \
    @lib/arm64-v8a/libbarhopper_v3.so \
    @lib/arm64-v8a/libbase.so \
    @lib/arm64-v8a/libc++.so \
    @lib/arm64-v8a/libc++_shared.so \
    @lib/arm64-v8a/libcutils.so \
    @lib/arm64-v8a/libdl_android.so \
    @lib/arm64-v8a/libmnnfacedetection.so \
    @lib/arm64-v8a/libmnnkitcore.so \
    @lib/arm64-v8a/libstitcher.so \
    @lib/arm64-v8a/libutils.so \
    @lib/arm64-v8a/libvndksupport.so \
    @lib/arm64-v8a/libyuv-utils.so

include $(BUILD_PREBUILT)
################################################################################

如果这篇文章有帮助到你,欢迎打赏,支持我的创作。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值