本文主要是介绍Android.mk介绍(三),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、编译APK
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)# 编译所有子目录下的Java文件LOCAL_SRC_FILES := $(call all-subdir-java-files)# APK名LOCAL_PACKAGE_NAME := LocalPackage# 编译成APKinclude $(BUILD_PACKAGE)
假如要编译的apk依赖静态.jar文件
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)# 包含的静态jar包LOCAL_STATIC_JAVA_LIBRARIES := static-libraryLOCAL_SRC_FILES := $(call all-subdir-java-files)LOCAL_PACKAGE_NAME := LocalPackageinclude $(BUILD_PACKAGE)
假如要编译一个platform key签名的APK
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := $(call all-subdir-java-files)LOCAL_PACKAGE_NAME := LocalPackageLOCAL_CERTIFICATE := platforminclude $(BUILD_PACKAGE)
LOCAL_CERTIFICATE:签名文件的文件名
假如要编译一个vendor key签名的APK
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := $(call all-subdir-java-files)LOCAL_PACKAGE_NAME := LocalPackageLOCAL_CERTIFICATE := vendor/example/certs/appinclude $(BUILD_PACKAGE)
二、编译jar包
编译静态JAR包
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
#获取指定目录下的所有java文件
LOCAL_SRC_FILES := $(call all-Java-files-under, src)
LOCAL_MODULE := com.tpv.yyd
#编译成静态jar包
include $(BUILD_STATIC_JAVA_LIBRARY)
编译动态JAR包
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := $(call all-subdir-java-files)LOCAL_MODULE := com.test.myjar#编译成动态JAR包include $(BUILD_JAVA_LIBRARY)
依赖其他JAR包
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := $(call all-subdir-java-files)# 依赖其他JAR包LOCAL_JAVA_LIBRARIES := android.test.runner# JAR包名LOCAL_MODULE := sampleinclude $(BUILD_STATIC_JAVA_LIBRARY)
这篇关于Android.mk介绍(三)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!