android framework层引入第三方jar

1.添加weka.jar
在mydroid/frameworks/opt/目录下新建weka目录,用于存放weka.jar包和mkfile文件,将weka.jar拷贝到该目录下,然后新建Android.mk文件,Android.mk文件内容如下:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := weka:weka.jar
include $(BUILD_MULTI_PREBUILT)
2.添加jar到framework的jar包中
修改android系统源码mydroid/frameworks/base/Android.mk文件:

==== the library =========================================include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(ext_src_files)

LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core
LOCAL_JAVA_RESOURCE_DIRS := $(ext_res_dirs)
#-------add weka.jar----
LOCAL_STATIC_JAVA_LIBRARIES := weka
#-------end add.
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := ext

LOCAL_DX_FLAGS := --core-library

include $(BUILD_JAVA_LIBRARY)
3.编译相应模块

mmm mydroid/frameworks/opt/weka/
mmm mydroid/frameworks/base/
4.在工程文件中将weka.jar添加到BUID PATH
5.到这一步就可以成功通过编译

你可能感兴趣的:(android framework层引入第三方jar)