SetupAndroid.bat Failed

hi,
I am installing android SDK for UE by following : Setting Up Android SDK and NDK for Unreal | Unreal Engine Documentation

and i have an issue when i start up SetupAndroid.bat

Same issue here… can anyone help?

Just in case this issue is still unresolved, this happened to me when I tried running the SetupAndroid.bat when I had already configured my Java JDK. In your environment variables, change the “JAVA_HOME” variable to point to the JRE included with Android Studio, as following:

image

If you look in the .bat file, you’ll see that it will use whatever path your system already has under “JAVA_HOME” and use that for running the script, but the recent version of Java SDK seems to be incompatible. So you can manually set this variable before running the .bat file to tell the script what specific JRE to use to download the NDK.

Alternatively, if the .bat file sees that you don’t have the “JAVA_HOME” variable specified, it will automatically look for the JRE included with Android Studio.

I believe you can change the value of this variable after running the .bat file to whatever value you had prior.

I recently faced this issue and the solution is very simple.
Go to your android sdk directory usually “C:\Users<username>\AppData\Local\Android\Sdk” and delete the tools directory. After that, run SetupAndroid.bat again and it will generate this directory again but this time the script will work :grinning:

You can thank me later :grin: