如何编译也static jar library.
17 # Note: the source code is in java/, not src/, because this code is also part of
18 # the framework library, and build/core/pathmap.mk expects a java/ subdirectory.
19
20 include $(CLEAR_VARS)
21 LOCAL_MODULE := android-common
22 LOCAL_SDK_VERSION := 8
23 LOCAL_SRC_FILES := \
24 $(call all-java-files-under, java) \
25 $(call all-logtags-files-under, java)
26 include $(BUILD_STATIC_JAVA_LIBRARY)
与编译package等结构大致相同,不同之处是使用"BUILD_STATIC_JAVA_LIBRARY",生成的jar文件不会copy到/system/framework/下面,
只会临时存在于../out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/目录下.
如何使用jar library.
6 LOCAL_STATIC_JAVA_LIBRARIES := \
7 android-common \
8 guava
9
10 LOCAL_SRC_FILES := \
11 $(call all-java-files-under, src) \
12 src/com/android/browser/EventLogTags.logtags
13
14 LOCAL_PACKAGE_NAME := Browser
在Android.mk中引入android build system的LOCAL_STATIC_JAVA_LIBRARIES变量,并给其赋值为:android-common。
如此以来,编译后的apk 或jar中就引入了所有的class文件,有点像C语言中的静态库文件(*.a)