Unreal 5.2.1 build for Android Failed

Hello,

I’m trying to build my Ue5.2.1 game for android from my windows pc. I have closely followed How to Set Up Android SDK and NDK For Your Unreal Engine Development Environment | Unreal Engine 5.2 Documentation documentation but so far no luck. I believe I have correctly installed Android Studio 4.0 with

Android API 32
Android SDK Build-Tools 29.0.3
Android SDK Command-line Tools 8.0

Then I have run the …/UE5.2/Engine/Extras/Android/SetupAndroid.bat which outputs “success”

I can see my android device plugged in using adb devices and when opening my game editor I can see my phone detected in the Project Launcher, which is great news.

But here is my Project Launcher output when running my “moto g power (2021) Android_ASTC” build:

ProjectLauncher.log (5.7 KB)

...
Android (8490178, based on r450784d) clang version 14.0.6 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/Users/esher/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin
Android (8490178, based on r450784d) clang version 14.0.6 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/Users/esher/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin
NDK toolchain: r25b, NDK version: 250200, ClangVersion: 14.0.6
Compiling Native 64-bit code with NDK API 'android-26'
Unhandled exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at EpicGames.Core.FileSystemReference.ContainsName(String name, Int32 offset, Int32 length) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\Shared\EpicGames.Core\FileSystemReference.cs:line 168
   at EpicGames.Core.FileSystemReference.ContainsName(String name, Int32 offset) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\Shared\EpicGames.Core\FileSystemReference.cs:line 155
   at UnrealBuildTool.LinkEnvironment.<>c__DisplayClass68_0.<.ctor>b__0(FileItem x) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\LinkEnvironment.cs:line 447
   at System.Linq.Enumerable.WhereListIterator`1.ToList()
   at UnrealBuildTool.LinkEnvironment..ctor(LinkEnvironment Other, UnrealArch OverrideArchitecture) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\LinkEnvironment.cs:line 447
   at UnrealBuildTool.UEToolChain.LinkAllFiles(LinkEnvironment LinkEnvironment, Boolean bBuildImportLibraryOnly, IActionGraphBuilder Graph) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ToolChain\UEToolChain.cs:line 125
   at UnrealBuildTool.UEBuildBinary.Build(ReadOnlyTargetRules Target, UEToolChain ToolChain, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment, List`1 SpecificFilesToCompile, ISourceFileWorkingSet WorkingSet, DirectoryReference ExeDir, IActionGraphBuilder Graph, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildBinary.cs:line 221
   at UnrealBuildTool.UEBuildTarget.Build(BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, TargetDescriptor TargetDescriptor, ILogger Logger, Boolean bInitOnly) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 2455
   at UnrealBuildTool.BuildMode.CreateMakefile(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 882
   at UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile, ILogger Logger, Boolean bSkipPreBuildTargets) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 392
   at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 248
   at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 599
Took 5.2568832s to run dotnet.exe, ExitCode=6
UnrealBuildTool failed. See log for more details. (C:\Users\esher\AppData\Roaming\Unreal Engine\AutomationTool\Logs\A+UE4+UE_5.2\UBT-Spark-Android-Development.txt)
AutomationTool executed for 0h 0m 8s
AutomationTool exiting with ExitCode=6 (6)
BUILD FAILED

If anyone knows what this may indicate - please share! I’m not sure what to make of the System.IndexOutOfRangeException. I have found this recent thread where cazeoj has a similar looking error: UE5.2.1 Android/Quest 2 Doesn't Package?

Any help is appreciated!

TLDR: It works on UE5.1!!

Small update, I’ve copied my project over and downgraded to UE5.1, cleaned / deleted Saved, Binaries, Intermediates etc…,
then attempted to build for android. This time I made it past the Build Game for Android phase.