- 前提条件
编译启动 launch 选择了 sdk_pc_x86_64-userdebug 该版本
- 添加一个三方预置应用
Android_source/vendor/third_party/MdmLib/MdmLib.apk
- 配置三方应用对应的Android.mk
Android_source/vendor/third_party/MdmLib/Android.mk
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := MdmLib
LOCAL_MODULE_STEM := MdmLib.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_MODULE_PATH := $(TARGET_OUT)/app
LOCAL_SRC_FILES := MdmLib.apk
# LOCAL_MULTILIB :=32 因为编译选择的是64位,需去掉,卡了半天才发现是这个属性导致
include $(BUILD_PREBUILT)
参考:
Android.mk 中的模块定义 您可以使用 LOCAL_MULTILIB 变量将 build 配置为适用于 32 位/64位架构,并替换全局 TARGET_PREFER_32_BIT 变量。 将 LOCAL_MULTILIB 设置为以下其中一项:
“both” 同时构建 32 位和 64 位架构。
“32” 仅构建 32 位架构。
“64” 仅构建 64 位架构。
“first” 仅构建第一个架构(在 32 位设备中构建 32 位架构,在 64 位设备中构建 64 位架构)。
默认为 “”。构建系统根据模块类和其他LOCAL_ 变量(如 LOCAL_MODULE_TARGET_ARCH 和 LOCAL_32_BIT_ONLY)决定要构建哪种架构。
- 配置对应厂商定制mk
Android_source/vendor/third_party/third_party.mk
PRODUCT_PACKAGES += \MdmLib\
- 根据编译版本在device下添加对应的mk配置:
Android_source/device/generic/goldfish/x86_64-vendor.mk
include device/generic/goldfish/x86_64-kernel.mk
# add third_party config
include vendor/third_party/third_party.mkPRODUCT_PROPERTY_OVERRIDES += \vendor.rild.libpath=/vendor/lib64/libgoldfish-ril.so# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
PRODUCT_COPY_FILES += \device/generic/goldfish/data/etc/config.ini.xl:config.ini \device/generic/goldfish/data/etc/advancedFeatures.ini:advancedFeatures.ini \device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \device/generic/goldfish/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json \$(EMULATOR_KERNEL_FILE):kernel-ranchuPRODUCT_SDK_ADDON_COPY_FILES += \device/generic/goldfish/data/etc/advancedFeatures.ini:images/x86_64/advancedFeatures.ini \device/generic/goldfish/data/etc/encryptionkey.img:images/x86_64/encryptionkey.img \$(EMULATOR_KERNEL_FILE):images/x86_64/kernel-ranchuPRODUCT_COPY_FILES += \device/generic/goldfish/data/etc/configs/gpu.config:data/misc/gceconfigs/gpu.config# a hack to reduce presubmit time where CTS tries to install media files one by one
# taking more than 30 minutes; following is just the list of files needed by current
# tests on presubmit
PRODUCT_COPY_FILES += \device/generic/goldfish/data/media/test/swirl_136x144_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_136x144_mpeg4.mp4 \device/generic/goldfish/data/media/test/swirl_132x130_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_132x130_mpeg4.mp4 \device/generic/goldfish/data/media/test/swirl_130x132_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_130x132_mpeg4.mp4 \device/generic/goldfish/data/media/test/swirl_144x136_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_144x136_mpeg4.mp4 \device/generic/goldfish/data/media/test/swirl_128x128_mpeg4.mp4:data/media/0/test/CtsMediaTestCases-1.4/swirl_128x128_mpeg4.mp4PRODUCT_PROPERTY_OVERRIDES += \ro.crypto.dm_default_key.options_format.version=2PRODUCT_SHIPPING_API_LEVEL := 33
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := false
TARGET_USES_MKE2FS := truePRODUCT_COPY_FILES += \device/generic/goldfish/fstab.ranchu.x86:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/first_stage_ramdisk/fstab.ranchu \device/generic/goldfish/fstab.ranchu.x86:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.ranchu
效果如下