# SetupAndroid.bat UE4.25 Error

**URL:** <https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836>\
**Category:** Mobile\
**Tags:** Mobile, unreal-engine, java, question\
**Created:** [May 10, 2020, 7:58pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836 "2020-05-10T19:58:14Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathisxy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mathisxy](https://forums.unrealengine.com/u/Mathisxy)\
**Post date:** [May 10, 2020, 7:58pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/1 "2020-05-10T19:58:14Z")

</div>

Hello,

I tried to install Android Studio for UE4.25. I upgraded my previous project from 4.24, where I used CodeWorks.

Now I uninstalled CodeWorks, installed Android Studio and got a few errors when running the SetupAndroid.bat file:

1. No SDK found (or something similar) → fixed it by installing some stuff via “SDK Manager” in Android Studio (dont remember the exact component)
2. ERROR: JAVA\_HOME is set to an invalid directory: C:\NVPACK\jdk1.8.0\_77 → fixed by installing OpenJDK 14 and setting the Environment Variable right
3. Android Studio Path: “C:\Program Files\Android\Android Studio”  
Android Studio SDK Path: C:\NVPACK\android-sdk-windows  
Using sdkmanager: C:\NVPACK\android-sdk-windows\tools\bin\sdkmanager.bat  
Exception in thread “main” java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema  
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)  
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)  
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)  
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)  
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)  
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema  
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)  
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)  
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)  
… 5 more  
Update failed. Please check the Android Studio install.  
Drücken Sie eine beliebige Taste . . .

And this is the Error I´m completely stuck and lost.  
I would appreciate any help!

---

<div class="post-metadata">

**Author:** ![vkikev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vkikev](https://forums.unrealengine.com/u/vkikev)\
**Post date:** [June 3, 2020, 1:44pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/2 "2020-06-03T13:44:51Z")

</div>

I’m stuck in the same error . Someone got a solution?

Please help!

---

<div class="post-metadata">

**Author:** ![jonas44444444](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonas44444444](https://forums.unrealengine.com/u/jonas44444444)\
**Post date:** [June 11, 2020, 12:52pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/3 "2020-06-11T12:52:14Z")

</div>

I managed to get around this problem by removing the JAVA\_HOME from PATH.

---

<div class="post-metadata">

**Author:** ![miracle7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@miracle7](https://forums.unrealengine.com/u/miracle7)\
**Post date:** [July 6, 2020, 11:57am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/4 "2020-07-06T11:57:04Z")

</div>

I ran into this issue as well when going through the steps on the wiki, removing JAVA\_HOME seems from my path seems to have resolved it for me as well - thank you!

---

<div class="post-metadata">

**Author:** ![salimrached](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@salimrached](https://forums.unrealengine.com/u/salimrached)\
**Post date:** [July 22, 2020, 6:18pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/5 "2020-07-22T18:18:03Z")

</div>

I struggled with this fro 2 days then I found this very useful video,  
It works like a charm  
Let’s all give him a thumbs up guys

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/c/4bc2ce75882b2f9d66e566bf97225f70941d8fff.jpeg "Installing Android Studio SDK & NDK For UE4 4.25") ](https://www.youtube.com/watch?v=q-mAEnqZb0M)

---

<div class="post-metadata">

**Author:** ![MyGreatUsername](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MyGreatUsername](https://forums.unrealengine.com/u/MyGreatUsername)\
**Post date:** [October 5, 2020, 10:05pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/6 "2020-10-05T22:05:06Z")

</div>

To anyone who may be following this to find a solution on why the HAXM error persists despite the virtualization is enabled, and the Hyper-V is off. Here is one apparently common thing which may be causing this in Win10: get to Edit Group Policy, Administrative Templates, System, Device guard and there will be two subcategory options. Normally they are set to Default, but you need to set them to Disabled.

Make sure you know what you are doing though, and happy developing! _cheers_

---

<div class="post-metadata">

**Author:** ![mumemrider](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mumemrider](https://forums.unrealengine.com/u/mumemrider)\
**Post date:** [October 14, 2020, 7:01am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/7 "2020-10-14T07:01:11Z")

</div>

Thank you so much, this worked!

---

<div class="post-metadata">

**Author:** ![MightyLeo14](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MightyLeo14](https://forums.unrealengine.com/u/MightyLeo14)\
**Post date:** [December 26, 2020, 4:10am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/8 "2020-12-26T04:10:50Z")

</div>

Thank you so much miracle7. You just made my day brother. I was suffering and being frustrated with this problem for last 3 days.

May Allah bless you.

---

<div class="post-metadata">

**Author:** ![jonas44444444](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonas44444444](https://forums.unrealengine.com/u/jonas44444444)\
**Post date:** [December 26, 2020, 10:41am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/9 "2020-12-26T10:41:42Z")

</div>

NP ma dude, have a nice day!

---

<div class="post-metadata">

**Author:** ![RichardAxe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RichardAxe](https://forums.unrealengine.com/u/RichardAxe)\
**Post date:** [March 27, 2021, 8:59am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/10 "2021-03-27T08:59:15Z")

</div>

Removing JAVA\_HOME from PATH sorted it for me also

---

<div class="post-metadata">

**Author:** ![Germolene](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Germolene](https://forums.unrealengine.com/u/Germolene)\
**Post date:** [June 8, 2021, 12:16pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/11 "2021-06-08T12:16:17Z")

</div>

If I can ask a stupid question,  
How / where do you remove JAVA HOME and secondly is there a safe way of backing it up incase it screws over other things on my system?

---

<div class="post-metadata">

**Author:** ![jonas44444444](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonas44444444](https://forums.unrealengine.com/u/jonas44444444)\
**Post date:** [June 8, 2021, 12:23pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/12 "2021-06-08T12:23:43Z")

</div>

search path in windows search open edit system environment variable → Enviroment Variables… -\>select JAVA\_HOME and delete it.

If you want to undo this delete you should save the current path to JAVA\_HOME somewhere and you can easily add it back with the new button.

---

<div class="post-metadata">

**Author:** ![Rhydian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rhydian](https://forums.unrealengine.com/u/Rhydian)\
**Post date:** [August 23, 2021, 9:38pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/13 "2021-08-23T21:38:53Z")

</div>

Ive been stuck on this for 3 hours, this fixed it! Thank you so much

---

<div class="post-metadata">

**Author:** ![Hanzyusuf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hanzyusuf](https://forums.unrealengine.com/u/Hanzyusuf)\
**Post date:** [August 24, 2021, 5:00am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/14 "2021-08-24T05:00:50Z")

</div>

**Another solution** _which might be better_: If you have previously installed java on your machine, instead of removing the env variable JAVA\_HOME, you should simply change it’s path to the one that you had installed.

In my case, it was: “C:\Program Files\Java\jre1.8.0\_51”, so I pointed the JAVA\_HOME to this path. This shall prevent breaking other softwares which might also be using the JAVA\_HOME variable to locate the java installation directory to use java.

**Beware** : if your java version mismatches the android studio java version by a significant margin, then you might face other problems too, maybe simply install the same version of java on your machine as that of the one which android studio has installed and point the env variable to that version instead.

---

<div class="post-metadata">

**Author:** ![gothicserpent](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gothicserpent/32/896180_2.png) [@gothicserpent](https://forums.unrealengine.com/u/gothicserpent)\
**Post date:** [August 25, 2021, 12:22am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/15 "2021-08-25T00:22:31Z")

</div>

You posted this only a few hours before I had the same issue. Your solution worked! I had two JRE folders, one in `C:\Program Files\Android\Android Studio\jre` and the other at `C:\Program Files\Java\jre1.8.0_301`.

Making `JAVA_HOME` `C:\Program Files\Java\jre1.8.0_301` in environment variables settings fixes it and allows me to run androidsetup.bat without error!

I am in the process of compiling my android game and this should help me fully compile the games and put them out on the google play store etc. Thanks!

edit: I actually had to set the path to this: `C:\Program Files\Java\jdk1.8.0_211` after installing jdk8 using chocolatey. this worked. jre doesn’t have tools.jar.

---

<div class="post-metadata">

**Author:** ![Hanzyusuf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hanzyusuf](https://forums.unrealengine.com/u/Hanzyusuf)\
**Post date:** [August 25, 2021, 6:07am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/16 "2021-08-25T06:07:55Z")

</div>

Glad that it helped, I don’t usually post =))

Two more things in case more people get stuck:

_ **1 -** _ If you have recently installed or updated Android Studio, it installs java version 11, but unreal 4 relies heavily on java 8 as of now, so it is better simply point the variable to that. But keep in mind that if you ever use android studio, you might again need java 11 for some specific library to compile/work, so you might have to change that back OR change android studio settings to make it use java version at a manually defined path (point to java 11).

_ **2 -** _ If your game does not package, remove sdk build tools version 31.0.0 and install 30.0.3 or lower. See [my answer here](https://answers.unrealengine.com/questions/867231/error-cmdexe-failed-with-args-1.html) for more details.

---

<div class="post-metadata">

**Author:** ![Hargrimms](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hargrimms](https://forums.unrealengine.com/u/Hargrimms)\
**Post date:** [September 6, 2021, 8:33am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/17 "2021-09-06T08:33:54Z")

</div>

It seems the problem is caused by the built-in command-line tools not supporting newer Java versions.

What allowed me to complete the script successfully was this: [Getting Android sdkmanager to run with Java 11 - Stack Overflow](https://stackoverflow.com/a/65782803).

1. Install Android Studio.
2. Open Android Studio and install Command-Line Tools.

 ![347955-ue4-android-setup-01.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/c/95c537558dd87483275c3e51b4d7f31bc3a16f81.png)

 ![347956-ue4-android-setup-02.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/e/a7ec6d4343c94ff7b4e89a7ff922cac5ed9628df.png)

1. Update \Engine\Extras\Android\SetupAndroid.bat:

---

<div class="post-metadata">

**Author:** ![sealfoss](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sealfoss](https://forums.unrealengine.com/u/sealfoss)\
**Post date:** [March 15, 2022, 10:13pm UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/18 "2022-03-15T22:13:40Z")

</div>

the hero we deserve

---

<div class="post-metadata">

**Author:** ![FourTwoK11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FourTwoK11](https://forums.unrealengine.com/u/FourTwoK11)\
**Post date:** [September 16, 2022, 1:02am UTC](https://forums.unrealengine.com/t/setupandroid-bat-ue4-25-error/464836/19 "2022-09-16T01:02:09Z")

</div>

He knows! He knows!
