I am trying to build Android AOSP on Mac OS X 10.13.6
When running make
it outputs
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
and ANDROID_JAVA_HOME
are both set to the directory of my JDK installation:
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
I know that the files under System/Library/.../Commands
are stubs pointing to the correct JDK installation but make
tries to find the tools.jar
in this directory, too.
Is there a way to tell make
to search in the right directory?
EDIT
Error appears in 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
But when running find-jdk-tools-jar.sh
it outputs the correct path, where the tools.jar is indeed located. So make uses some other fallback?
On OSX, /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/ is not where JDK root is. JDK install home is usually /Library/Java/JavaVirtualMachines/jdk[whatever you have installed].jdk/Contents/Home
You need to configure your JAVA_HOME correctly.