# SetupAndroid.bat Failed

**URL:** <https://forums.unrealengine.com/t/setupandroid-bat-failed/155323>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [December 19, 2020, 3:57pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-failed/155323 "2020-12-19T15:57:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DCW\_ArtZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DCW\_ArtZ](https://forums.unrealengine.com/u/DCW_ArtZ)\
**Post date:** [December 19, 2020, 3:57pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-failed/155323/1 "2020-12-19T15:57:40Z")

</div>

hi,  
I am installing android SDK for UE by following : [Setting Up Android SDK and NDK for Unreal | Unreal Engine Documentation](https://docs.unrealengine.com/en-US/SharingAndReleasing/Mobile/Android/Setup/AndroidStudio/index.html)

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

 ![capSdk.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/f/4f8d3202a95b1c7e61124d2590a720623ac6eddb.png)

---

<div class="post-metadata">

**Author:** ![Lebman15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lebman15](https://forums.unrealengine.com/u/Lebman15)\
**Post date:** [February 24, 2022, 4:47pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-failed/155323/2 "2022-02-24T16:47:54Z")

</div>

Same issue here… can anyone help?

---

<div class="post-metadata">

**Author:** ![david4jsus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@david4jsus](https://forums.unrealengine.com/u/david4jsus)\
**Post date:** [March 10, 2022, 12:35am UTC](https://forums.unrealengine.com/t/setupandroid-bat-failed/155323/3 "2022-03-10T00:35:59Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/1/9811726c222d8fc106ade2a5341d5a18e827192e.png)

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.

---

<div class="post-metadata">

**Author:** ![TrueFranco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/truefranco/32/1095055_2.png) [@TrueFranco](https://forums.unrealengine.com/u/TrueFranco)\
**Post date:** [March 15, 2022, 6:33pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-failed/155323/4 "2022-03-15T18:33:04Z")

</div>

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 😀

You can thank me later 😁
