我正在尝试在Mac OS X 10.13.6上构建Android AOSP
运行make
时它会输出
build/core/config.mk:601: *** Error: could not find jdk tools.jar at /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/../lib/tools.jar, please check if your JDK was installed correctly. Stop.
JAVA_HOME
和ANDROID_JAVA_HOME
都设置为我的JDK安装目录:
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
我知道System/Library/.../Commands
下的文件都是指向正确的JDK安装的存根,但是make
也在该目录中尝试找到tools.jar
。
是否可以告诉make
在正确的目录中进行搜索?
编辑
错误出现在config.mk:601
# We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh.
ifneq ($(CALLED_FROM_SETUP),true)
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
ifneq ($(HOST_JDK_TOOLS_JAR),)
ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
$(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR),
please check if your JDK was installed correctly)
endif
endif
但是在运行find-jdk-tools-jar.sh
时,它将输出正确的路径,tools.jar确实位于该路径。那么make使用其他后备吗?
答案 0 :(得分:1)
在OSX上,/ System / Library / Frameworks / JavaVM.framework / Versions / Current / Commands /不在JDK根目录下。 JDK的安装目录通常为/ Library / Java / JavaVirtualMachines / jdk [无论您安装了什么] .jdk / Contents / Home
您需要正确配置JAVA_HOME。