Android Packaging Error in Unreal Engine 5.2 - Issue with SetupAndroid.bat

Hello everyone,

I am experiencing an issue while packaging my Unreal Engine 5.2 project for Android. When I run the packaging process, I get the following error related to the execution of the SetupAndroid.bat script:

UATHelper: Packaging (Android (ASTC)): ERROR: Command D:\LOGICIELS\UE_5.2\Engine\Extras\Android\SetupAndroid.bat android-32 30.0.3 3.10.2.4988404 25.1.8937393 -noninteractive failed [Exit code 4, working dir = D:\LOGICIELS\UE_5.2\Engine\Extras\Android]
PackagingResults: Error: Command D:\LOGICIELS\UE_5.2\Engine\Extras\Android\SetupAndroid.bat android-32 30.0.3 3.10.2.4988404 25.1.8937393 -noninteractive failed [Exit code 4, working dir = D:\LOGICIELS\UE_5.2\Engine\Extras\Android]

Steps Taken to Resolve the Issue:

  1. Checked Android Prerequisites:
  • Ensured the required versions of SDK, NDK, and JDK are installed:
    • Android SDK: Version 30.0.3
    • Android NDK: Version 21
    • JDK: Version 1.8 (JAVA_HOME configured correctly)
    • Gradle: Compatible with the SDK
  1. Manual Execution of SetupAndroid.bat:
  • Tried to manually execute the script in the directory D:\LOGICIELS\UE_5.2\Engine\Extras\Android using the command:

cmd

Copier le code

SetupAndroid.bat android-32 30.0.3 3.10.2.4988404 25.1.8937393 -noninteractive
  • This generated the following error:

csharp

Copier le code

SetupAndroid.bat : The term 'SetupAndroid.bat' is not recognized as the name of a cmdlet, function, script file, or operable program.
  1. Android Command Line Tools Version Issue:
  • Received the following warnings:

bash

Copier le code

Warning: Observed package id 'cmdline-tools;8.0' in inconsistent location 'C:\Users\Lisa\AppData\Local\Android\Sdk\cmdline-tools\latest' (Expected 'C:\Users\Lisa\AppData\Local\Android\Sdk\cmdline-tools\8.0')
  1. Java Class Error with sdkmanager:
  • While using sdkmanager to update the tools, the following error occurred:

arduino

Copier le code

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

Current Configuration:

  • Unreal Engine Version: 5.2
  • JDK Version: 1.8.0_351
  • Android SDK Path: C:\Users\Lisa\AppData\Local\Android\Sdk
  • Android Studio Path: C:\Program Files\Android\Android Studio1
  • sdkmanager Path: C:\Users\Lisa\AppData\Local\Android\Sdk\cmdline-tools\8.0\bin\sdkmanager.bat

Additional Actions Taken:

  • Reinstalled command line tools to the correct version.
  • Verified and updated environment variables (JAVA_HOME, ANDROID_HOME, NDK_ROOT).
  • Removed and reinstalled SDK and NDK components via Android Studio and sdkmanager.

Request for Help:

I am out of ideas to resolve this issue. Has anyone encountered a similar situation or have suggestions on how to fix this error during Android packaging in Unreal Engine?

Thanks in advance for your help!