Error when running SetupAndroid.command

I started a project from the racing demo starting example project, and attempted to run it on an android device. I began setting up for android, and was running the SetupAndroid.command script that was included with the instructions from step 3 found here:

I receive this error:

Hi Perryneal,

I’m not familiar with Mac, but in Windows the “Environment Variables” point to the install location of different SDKs, for example you can type ‘adb’ into command prompt and if your environment variables are set it will know where “Android Debug Bridge.exe” is.

Here’s another doc that might be helpful.

In the Windows version of that doc it mentions

JAVA_HOME

  • Set this to where the JDK is installed. It will probably be called something like jdk1.8.0_121.
  • It must contain a directory called bin with javac.exe in it.

So big picture: You’d want to set your Environment Variable for JAVA_HOME to point to wherever javac.exe (or whatever mac equivalent is) is installed.

Hope that helps!

Thank you for the response. In my image here you will see that Javac is installed in the directory the error refers to, and that I have JAVA_HOME variable pointing to that location.

Another intersting thing here is, there is two JAVA_HOME variables. When running the android install command script, it actually creates an additional JAVA_HOME variable, then reports that the path is not acceptable.

It seems there is a problem with the script possibly. I have also tried escaping the white space is in the path, and adding/removing bin in the path as well.

Hi perryneal11. Have you found a solution to this problem?

Hey,
you can try to fix the problem by removing the “jdk” folder from the line 99 in the file SetupAndroid.command.
This line :

export JAVA_HOME="$STUDIO_PATH/Contents/jre/**jdk**/Contents/Home"

becomes :

export JAVA_HOME="$STUDIO_PATH/Contents/jre/Contents/Home"

But it depends on the version of your Android Studio.
You should check the path of your JDK in the Android Studio Package (Go in applications > Android Studio and right click to see package content, then you should see the jre or jrb folder)
The last version (Electric Eel) change the JDK location and apparently, the Android Setup file coming with UE5.1 is not up to date.

Hope it helps