背景
项目中使用到了第三方jar包,记录一下使用的过程
实现
1.在external/demob/添加Android.mk文件以及jar包文件
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := demob
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := demob-1.60.jar
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
2.在frameworks/base/Android.mk中添加
(注意添加位置,需要在LOCAL_MODULE := framework之前)
LOCAL_STATIC_JAVA_LIBRARIES += demob ### add this line
LOCAL_MODULE := framework
LOCAL_DX_FLAGS := --core-library --multi-dex
LOCAL_JACK_FLAGS := --multi-dex native
参考 http://saurabhsharma123k.blogspot.com/2017/03/add-and-use-external-library-or-jar.html