android mk学习-编译apk文件

基于AN 8.0 ,在 vendor/xxx/common/apps/ 目录新建 Test 文件夹,
把 Test.apk 放到 Test 文件夹下,
在 Test 文件夹添加 Android.mk ,添加如下内容

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE := Test
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(LOCAL_MODULE)$(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)

# ==============================================================================
include $(call all-makefiles-under,$(LOCAL_PATH))

其中 LOCAL_MODULE 就是编译的 apk 名称

LOCAL_MODULE := Test

如果需要依赖 jni 库, jni 库放到 mk 同级目录,修改如下

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE := Test
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(LOCAL_MODULE)$(COMMON_ANDROID_PACKAGE_SUFFIX)
# 指定 jni 目录
LOCAL_REQUIRED_MODULES := libxxx_jni
include $(BUILD_PREBUILT)

# ==============================================================================
include $(call all-makefiles-under,$(LOCAL_PATH))

你可能感兴趣的:(Android,编译,mk)