解决android libcore局部编译时`out/target/common/obj/JAVA_LIBRARIES/sqlite-jdbc_intermediates/javalib.jar'

在最近的工作中,对libcore/下的文件进行了修改,编译时遇到了如下错误:


make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/sqlite-jdbc_intermediates/javalib.jar', 
needed by `out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes-full-debug.jar'.  Stop.


以往的解决方案很暴力,都是直接将整个源码进行一次重新编译,也可以通过,不过这种做法很没有工程师精神,

于是将libcore下的Android.mk文件进行了梳理,发现与JAVA_LIBRARIES以及sqlite同时相关的编译语句是用于测试的,

现在并不需要测试,其中一部分语句如下:

ifeq ($(LIBCORE_SKIP_TESTS),)
# Make the core-tests library.
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(test_src_files)
LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core-libart okhttp core-junit bouncycastle
LOCAL_STATIC_JAVA_LIBRARIES := core-tests-support sqlite-jdbc mockwebserver nist-pkix-tests
LOCAL_JAVACFLAGS := $(local_javac_flags)
LOCAL_MODULE := core-tests
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/JavaLibrary.mk
include $(BUILD_STATIC_JAVA_LIBRARY)
endif


于是在libcore\JavaLibraby.mk文件的开头加入了一句export LIBCORE_SKIP_TESTS := false


加入位置摘抄:

 The Java files and their associated resources.
common_core_src_files := $(call all-main-java-files-under,dalvik dex dom json luni xml)
core_resource_dirs := $(call all-core-resource-dirs,main)
test_resource_dirs := $(call all-core-resource-dirs,test)
test_src_files := $(call all-test-java-files-under,dalvik dom harmony-tests json luni xml)


# ///*** 修改在这里
export LIBCORE_SKIP_TESTS := false
# ///*** 修改完毕


ifeq ($(EMMA_INSTRUMENT),true)
ifneq ($(EMMA_INSTRUMENT_STATIC),true)


再次mmm libcore,编译成功!




你可能感兴趣的:(一块砖的android源码之路)