在某一应用程序中有时候需要引用第三方jar包,那么怎么才能在编译app的时候把该jar包引入进入呢?
在该app下的Android.mk文件中添加如下语句:
------------------------------start-----------------------------------------------
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := user eng
########################################
LOCAL_STATIC_JAVA_LIBRARIES := lib3party //定义引用名
########################################
....
include $(BUILD_PACKAGE)
###############################################################
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := lib3part:libs/3part.jar // 引用名:jar包名
include $(BUILD_MULTI_PREBUILT)
################################################################
--------------------------------end----------------------------------------------------------------
不明白的话,请参考计算器app包.
\packages\apps\Calculator
android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := libarity
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
LOCAL_PACKAGE_NAME := Calculator
include $(BUILD_PACKAGE)
##################################################
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libarity:arity-2.1.2.jar
include $(BUILD_MULTI_PREBUILT)
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
--------------------------------------------
arity-2.1.2.jar: 就放在本地包目录下。