Package Project for android VR failed, need help!

I’m trying to package a project to Meta Quest 2 and keep getting this build error. I have tried with a new project and have been using this tutorial: https://www.youtube.com/watch?v=znvDJ9E-SFk&t=2325s

I am using 5.4.4.

Error:

UATHelper: Packaging (Android (ASTC)): UnrealBuildTool failed. See log for more details. (C:\Users\niall\AppData\Roaming\Unreal Engine\AutomationTool\Logs\A+Epic+UE_5.4\UBA-BuildtoQuest_Test-Android-Development.txt)
UATHelper: Packaging (Android (ASTC)): AutomationTool executed for 0h 0m 37s
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=6 (6)
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
LogAudioDerivedData: Display: Building compressed audio format BINKA hash BINKA_SCVER_5028_R4DV_false_SR0_48000.000000_SR1_32000.000000_SR2_24000.000000_SR3_12000.000000_SR4_8000.000000_QMOD_1.000000_CQLT_-1_ASTH_0.000000_INLC_false_LCK1_0.000000_CSZE_65536_LCF_false_ZCS_256_MCSO_0_END wave CompileFailed…
PackagingResults: Error: Unknown Error

Full output log:

Compile module: BuildtoQuest_Test
Module ‘BuildtoQuest_Test’ uses PCH ‘arm64’ for Architecture ‘C:\Users\niall\Documents\Unreal Projects\BuildtoQuest_Test\Intermediate\Build\Android\a\BuildtoQuest_Test\Development\Core\SharedPCH.Core.Project.ValApi.Cpp20.h.gch’
Total execution time: 32.12 seconds
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 159
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 147
at UnrealBuildTool.LinkEnvironment.<>c__DisplayClass71_0.<.ctor>b__0(FileItem x) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\LinkEnvironment.cs:line 462
at System.Linq.Enumerable.WhereListIterator1.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 462 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 138 at UnrealBuildTool.UEBuildBinary.Build(ReadOnlyTargetRules Target, UEToolChain ToolChain, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment, ISourceFileWorkingSet WorkingSet, DirectoryReference ExeDir, IActionGraphBuilder Graph, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildBinary.cs:line 277 at UnrealBuildTool.UEBuildTarget.BuildAsync(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 2641 at UnrealBuildTool.BuildMode.CreateMakefileAsync(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 1136 at UnrealBuildTool.BuildMode.BuildAsync(List1 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 396
at UnrealBuildTool.BuildMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 252
at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 660
Unhandled exception: 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 159
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 147
at UnrealBuildTool.LinkEnvironment.<>c__DisplayClass71_0.<.ctor>b__0(FileItem x) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\LinkEnvironment.cs:line 462
at System.Linq.Enumerable.WhereListIterator1.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 462 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 138 at UnrealBuildTool.UEBuildBinary.Build(ReadOnlyTargetRules Target, UEToolChain ToolChain, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment, ISourceFileWorkingSet WorkingSet, DirectoryReference ExeDir, IActionGraphBuilder Graph, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildBinary.cs:line 277 at UnrealBuildTool.UEBuildTarget.BuildAsync(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 2641 at UnrealBuildTool.BuildMode.CreateMakefileAsync(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 1136 at UnrealBuildTool.BuildMode.BuildAsync(List1 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 396
at UnrealBuildTool.BuildMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 252
at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 660
WriteFileIfChanged() wrote 20 changed files of 20 requested writes.
Timeline:

[ 0.000]
0.000
[32.184]

Also to me packing for meta quest 2 gave ploblems, in my case it was because of gltf materials , but from the error it gives you could be that the problem is in the naming of some file?

Hello there @niall010!

Thank you for the log extract, this looks like a tricky scenario. From what I can see, the chain starts to break in the following line:

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

This call suggest that the build is trying to reach for a missing or incorrect path. The first step would be to confirm that all file path are correctly set in your project, as well as ensure that your Android SDK, NDK, and JDK are in the proper versions. A similar scenario was encounterd here:

If the issue persists after that, I would suggest refreshing the build, via deleting the contents from folders Intermediate, Binaries, and Saved, then regenerating and rebuilding the project.

Finally, make sure that all elements tied to Visual Studio 2022 are also properly setup: