Error JAVA_HOME is not defined correctly

When I try to build on Android, I got following error:

Error: JAVA_HOME is not defined correctly.

We cannot execute /Library/Java/JavaVirtualMachines/Contents/Home/bin/java

(exit code: 1)

(unknown): E0000: Native build failed (1,500.38 ms)

My JAVA_HOME is: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home

which seems to be correct. This happens also for Preview. I have tried to setup also this exact path to sdkconfig.json file but it did not help on the situation.

Additional information. I had also run the android install check with param -s, all seemed to be in order there.

Hey, sorry was a bug in latest release related to your issue. We are about to release a fix for it.

In the meanwhile set ~/sdkConfig.json to point to this path instead /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk(Note without Contents/Home) and set PathPattern to be empty. Then run fuse install android again.

okay, thanks. I will try this.

EDIT: Great, worked as a charm.

Good it worked out for you :slight_smile:

A hotfix release has also been published(Fuse 0.9.7)

I just had this issue. I ran “fuse build -v -r -t=android” (since I had issues with preview) to find the issue. Notice the “-v” flag for verbosity level (shows everything that would be normally hidden in the background). This is important. It seemed that Fuse was still pointing to Java JDK 1.6.0 also I had it updated. I tried everything but nothing worked. It seems that Fuse had an internal cash of JAVA_HOME and can’t pickup the new version. My simply and quick solution was simply run “fuse install android”. Build worked fine after that but not preview.

Emil Sandstø wrote:

Hey, sorry was a bug in latest release related to your issue. We are about to release a fix for it.

In the meanwhile set ~/sdkConfig.json to point to this path instead /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk(Note without Contents/Home) and set PathPattern to be empty. Then run fuse install android again.

Ha ha! Just as I had suspected!

I’ve changed the contents of “sdkConfig.json” file to point to my jdk1.8.0_101.jdk however the preview process still finds JDK version 1.6.65. Even running the “fuse install android” command overwrites the “sdkConfig.json” with an JDK 1.7 version.

So it seems as if the “sdkConfig.json” file is being ignored by the “fuse preview -t=Android” command.

The only solution I’ve found is to uninstall android SDK 24. Is there a better solution?

That’s interesting, hmm what does uno config say, after you have ran fuse install android?