1.新建一个目录taideTest用来存放需要集成的apk
存放位置:vendor\mediatek\proprietary\packages\3rd-party\LBS

2.创建一个android.mk文件并把需要集成的apk拷入当前目录下
存放位置:vendor\mediatek\proprietary\packages\3rd-party\LBS\taideTest

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := 文件目录
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := apk名称.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS_PRIVILEGED) #/system/priv-app
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_PRIVILEGED_MODULE := false

#检查apk里lib目录如果包含armeabi-v7a,这选择这个目录下的so文件,否则选择armeabi目录下的so文件
PRIVATE_EMBEDDED_JNI_LIBS := 'lib/armeabi-v7a/*.so' 
 #PRIVATE_EMBEDDED_JNI_LIBS := 'lib/armeabi/*.so'

JNI_LIBS :=
$(foreach FILE,$(shell if unzip -l $(LOCAL_PATH)/$(LOCAL_SRC_FILES) $(PRIVATE_EMBEDDED_JNI_LIBS) > /dev/null ; then \
        rm -rf $(LOCAL_PATH)/uncompressedlibs && \
        mkdir $(LOCAL_PATH)/uncompressedlibs; \
        unzip $(LOCAL_PATH)/$(LOCAL_SRC_FILES) $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(LOCAL_PATH)/uncompressedlibs > /dev/null && \
        find $(LOCAL_PATH)/uncompressedlibs -name *.so; \
    fi),$(eval JNI_LIBS += $(FILE)))
$(info echo $(JNI_LIBS))
LOCAL_PREBUILT_JNI_LIBS := $(subst $(LOCAL_PATH),,$(JNI_LIBS))

include $(BUILD_PREBUILT)

3.添加PRODUCT_PACKAGES 配置
修改位置:device\mediateksample\aiv8167sm3_bsp\device.mk
PRODUCT_PACKAGES += taideTest(文件目录)

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐