Issues when Packaging for Android.

Hi, I work in Arch Visualization and we are attempting to package an optimized file in UE 5.1.1 as an APK to be side-loaded into a Quest 3. I have attempted to install the Android SDK and NDK twice now and while the option appears in the packaging drop-down menu, every attempt is met with an unknown error and the build fails. My output log is as such:

LogSlate: Window ‘Message’ being destroyed
Message dialog closed, result: Yes, title: Message, text: The Binaries for this Target Platform are not currently installed, would you like to use the Launcher to download them?
LogUObjectHash: Compacting FUObjectHashTables data took 0.36ms
LogTurnkeySupport: Project requires temp target (OpenXR plugin is enabled)
LogLauncherProfile: Unable to use promoted target - Z:/_ (MU) MIXED USE RETAIL/2023/MU-2306 Mahkers Soccer in the Streets, ATL GA/Unreal/MyProject5/Binaries/Android/UnrealGame.target does not exist.
LogMonitoredProcess: Running Serialized UAT: [ cmd.exe /c ““C:/Program Files/Epic Games/UE_5.1/Engine/Build/BatchFiles/RunUAT.bat” -ScriptsForProject=“Z:/_ (MU) MIXED USE RETAIL/2023/MU-2306 Mahkers Soccer in the Streets, ATL GA/Unreal/MyProject5/MyProject5.uproject” Turnkey -command=VerifySdk -platform=Android -UpdateIfNeeded -EditorIO -EditorIOPort=54481 -project=“Z:/_ (MU) MIXED USE RETAIL/2023/MU-2306 Mahkers Soccer in the Streets, ATL GA/Unreal/MyProject5/MyProject5.uproject” BuildCookRun -nop4 -utf8output -nocompileeditor -skipbuildeditor -cook -project=“Z:/_ (MU) MIXED USE RETAIL/2
023/MU-2306 Mahkers Soccer in the Streets, ATL GA/Unreal/MyProject5/MyProject5.uproject” -unrealexe=“C:\Program Files\Epic Games\UE_5.1\Engine\Binaries\Win64\UnrealEditor-Cmd.exe” -platform=Android -cookflavor=ASTC -installed -stage -archive -package -build -pak -iostore -compressed -prereqs -archivedirectory=“C:/Users/EA-4090/Desktop”” -nocompile -nocompileuat ]
UATHelper: Packaging (Android (ASTC)): Running AutomationTool…
UATHelper: Packaging (Android (ASTC)): Using bundled DotNet SDK version: 6.0.302
UATHelper: Packaging (Android (ASTC)): Starting AutomationTool…
UATHelper: Packaging (Android (ASTC)): Parsing command line: -ScriptsForProject=“Z:/_ (MU) MIXED USE RETAIL/2023/MU-2306 Mahkers Soccer in the Streets, ATL GA/Unreal/MyProject5/MyProject5.uproject” Turnkey -command=VerifySdk -platform=Android -UpdateIfNeeded -EditorIO -EditorIOPort=54481 -project=“Z:/_ (MU) MIXED USE RETAIL/2023/MU-2306 Mahkers Soccer in the Streets, ATL GA/Unreal/MyProject5/MyProject5.uproject” BuildCookRun -nop4 -utf8output -nocompileeditor -skipbuildeditor -cook -project=“Z:/_ (MU) MIXED USE RETAIL/2023/MU-2306 Mahkers Soccer in the Streets, ATL GA/Unreal/MyProject5/MyPr
oject5.uproject” -unrealexe=“C:\Program Files\Epic Games\UE_5.1\Engine\Binaries\Win64\UnrealEditor-Cmd.exe” -platform=Android -cookflavor=ASTC -installed -stage -archive -package -build -pak -iostore -compressed -prereqs -archivedirectory=C:/Users/EA-4090/Desktop -nocompile -nocompileuat
UATHelper: Packaging (Android (ASTC)): Initializing script modules…
UATHelper: Packaging (Android (ASTC)): Total script module initialization time: 0.12 s.
UATHelper: Packaging (Android (ASTC)): WARNING: Error while enumerating Visual Studio toolchains
PackagingResults: Warning: Error while enumerating Visual Studio toolchains
UATHelper: Packaging (Android (ASTC)): WARNING: Assuming no compilation capability for NET Framework projects.
PackagingResults: Warning: Assuming no compilation capability for NET Framework projects.
UATHelper: Packaging (Android (ASTC)): Executing commands…
UATHelper: Packaging (Android (ASTC)): Installed Sdk validity:
UATHelper: Packaging (Android (ASTC)): Android: (Status=Valid, Allowed_Sdk=r25b, Current_Sdk=r25b, Allowed_AutoSdk=r25b, Current_AutoSdk=, Flags=“InstalledSdk_ValidVersionExists, Sdk_HasBestVersion”)
UATHelper: Packaging (Android (ASTC)): Scanning for envvar changes…
UATHelper: Packaging (Android (ASTC)): … done!
UATHelper: Packaging (Android (ASTC)): Cleaning Temp Paths…
UATHelper: Packaging (Android (ASTC)): BUILD SUCCESSFUL
UATHelper: Packaging (Android (ASTC)): Setting up ProjectParams for Z:_ (MU) MIXED USE RETAIL\2023\MU-2306 Mahkers Soccer in the Streets, ATL GA\Unreal\MyProject5\MyProject5.uproject
UATHelper: Packaging (Android (ASTC)): ERROR: System.ArgumentException: An item with the same key has already been added. Key: TwinmotionToUnrealContent
UATHelper: Packaging (Android (ASTC)): at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) UATHelper: Packaging (Android (ASTC)): at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)
UATHelper: Packaging (Android (ASTC)): at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](List1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)
UATHelper: Packaging (Android (ASTC)): at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)
UATHelper: Packaging (Android (ASTC)): at AutomationTool.ProjectUtils.RequiresTempTarget(FileReference RawProjectPath, Boolean bProjectHasCode, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, TargetType TargetType, Boolean bRequiresAssetNativization, Boolean bRequiresCookedData, String& OutReason) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 294
UATHelper: Packaging (Android (ASTC)): at AutomationTool.ProjectUtils.RequiresTempTarget(FileReference RawProjectPath, List1 Platforms, List1 Configurations, Boolean AssetNativizationRequested) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 241
UATHelper: Packaging (Android (ASTC)): at AutomationTool.ProjectUtils.DetectProjectProperties(FileReference RawProjectPath, List1 ClientTargetPlatforms, List1 ClientTargetConfigurations, Boolean AssetNativizationRequested) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 613
UATHelper: Packaging (Android (ASTC)): at AutomationTool.ProjectUtils.GetProjectProperties(FileReference RawProjectPath, List1 ClientTargetPlatforms, List1 ClientTargetConfigurations, Boolean AssetNativizationRequested) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 175
UATHelper: Packaging (Android (ASTC)): at AutomationTool.ProjectParams.AutodetectSettings(Boolean bReset) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectParams.cs:line 2306
PackagingResults: Error: System.ArgumentException: An item with the same key has already been added. Key: TwinmotionToUnrealContent
UATHelper: Packaging (Android (ASTC)): at AutomationTool.ProjectParams…ctor(FileReference RawProjectPath, BuildCommand Command, String Device, String MapToRun, String AdditionalServerMapParams, ParamList1 Port, String RunCommandline, String StageCommandline, String BundleName, String StageDirectoryParam, String UnrealExe, String UE4Exe, String SignPak, List1 ClientConfigsToBuild, List1 ServerConfigsToBuild, ParamList1 MapsToCook, ParamList1 MapIniSectionsToCook, ParamList1 DirectoriesToCook, String DDCGraph, String InternationalizationPreset, ParamList1 CulturesToCook, ParamL ist1 ClientCookedTargets, ParamList1 EditorTargets, ParamList1 ServerCookedTargets, List1 ClientTargetPlatforms, Dictionary2 ClientDependentPlatformMap, List1 ServerTargetPlatforms, Dictionary2 ServerDependentPlatformMap, Nullable1 Build, Nullable1 SkipBuildClient, Nullable1 SkipBuildEditor, Nullable1 Cook, Nullable1 Run, Nullable1 SkipServer, Nullable1 Clean, Nullable1 Compressed, Nullable1 ForceUncompressed, String AdditionalPakOptions, String AdditionalIoStoreOptions, Nullable1 IterativeCooking, String IterateSharedCookedBuild, Nullable1 IterateSharedBuildUsePrecompiledExe , Nullable1 CookAll, Nullable1 CookPartialGC, Nullable1 CookInEditor, String CookOutputDir, Nullable1 CookMapsOnly, Nullable1 CookOnTheFly, Nullable1 CookOnTheFlyStreaming, Nullable1 UnversionedCookedContent, Nullable1 OptionalContent, Nullable1 EncryptIniFiles, Nullable1 EncryptPakIndex, Nullable1 EncryptEverything, Nullable1 SkipCookingEditorContent, String AdditionalCookerOptions, String OriginalReleaseVersion, String BasedOnReleaseVersion, String CreateReleaseVersion, String CreateReleaseVersionBasePath, String BasedOnReleaseVersionBasePath, String ReferenceContainerGlobalFileN ame, String ReferenceContainerCryptoKeys, Nullable1 GeneratePatch, Nullable1 AddPatchLevel, Nullable1 StageBaseReleasePaks, String DiscVersion, String DLCName, String DLCOverrideCookedSubDir, String DLCOverrideStagedSubDir, String DiffCookedContentPath, Nullable1 DLCIncludeEngineContent, Nullable1 DLCPakPluginFile, Nullable1 DLCActLikePatch, Nullable1 CrashReporter, Nullable1 DedicatedServer, Nullable1 Client, Nullable1 Deploy, String DeployFolder, String GetFile, Nullable1 FileServer, Nullable1 Foreign, Nullable1 ForeignCode, Nullable1 LogWindow, Nullable1 NoCleanStage, Nullabl
e1 NoClient, Nullable1 NoDebugInfo, Nullable1 SeparateDebugInfo, Nullable1 MapFile, Nullable1 NoXGE, Nullable1 SkipPackage, Nullable1 NeverPackage, Nullable1 Package, Nullable1 Pak, Nullable1 IgnorePaksFromDifferentCookSource, Nullable1 IoStore, Nullable1 Cook4IoStore, Nullable1 ZenStore, String NoZenAutoLaunch, Nullable1 SkipIoStore, Nullable1 GenerateOptimizationData, Nullable1 Prereqs, String AppLocalDirectory, Nullable1 NoBootstrapExe, Nullable1 SignedPak, Nullable1 PakAlignForMemoryMapping, Nullable1 RehydrateAssets, Nullable1 NullRHI, Nullable1 FakeClient, Nullable 1 EditorTest, Nullable1 RunAutomationTests, String RunAutomationTest, Nullable1 CrashIndex, Nullable1 SkipCook, Nullable1 SkipCookOnTheFly, Nullable1 SkipPak, Nullable1 PrePak, Nullable1 SkipStage, Nullable1 Stage, Nullable1 Manifests, Nullable1 CreateChunkInstall, Nullable1 SkipEncryption, Nullable1 Unattended, Nullable1 NumClients, Nullable1 Archive, String ArchiveDirectoryParam, Nullable1 ArchiveMetaData, Nullable1 CreateAppBundle, String SpecifiedClientTarget, String SpecifiedServerTarget, ParamList1 ProgramTargets, Nullable1 Distribution, String PackageEncryptionKeyFile, Nullable1 Prebuilt, Nullable1 RunTimeoutSeconds, String SpecifiedArchitecture, String UbtArgs, String AdditionalPackageOptions, Nullable1 IterativeDeploy, Nullable1 FastCook, Nullable1 IgnoreCookErrors, Nullable1 CodeSign, Nullable1 TreatNonShippingBinariesAsDebugFiles, Nullable1 UseExtraFlavor, String Provision, String Certificate, String Team, Boolean AutomaticSigning, String Trace, String TraceHost, String TraceFile, String SessionLabel, ParamList1 InMapsToRebuildLightMaps, ParamList1 InMapsToRebuildHLOD, ParamList1 TitleID) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Sou
rce\Programs\AutomationTool\AutomationUtils\ProjectParams.cs:line 1223
UATHelper: Packaging (Android (ASTC)): at BuildCookRun.SetupParams() in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 49
UATHelper: Packaging (Android (ASTC)): at BuildCookRun.ExecuteBuild() in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 40
UATHelper: Packaging (Android (ASTC)): at AutomationTool.BuildCommand.Execute() in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 344
UATHelper: Packaging (Android (ASTC)): at AutomationTool.BuildCommand.ExecuteAsync() in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 353
UATHelper: Packaging (Android (ASTC)): at AutomationTool.Automation.ExecuteAsync(List1 CommandsToExecute, Dictionary2 Commands) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 257
UATHelper: Packaging (Android (ASTC)): at AutomationTool.Automation.ProcessAsync(ParsedCommandLine AutomationToolCommandLine, StartupTraceListener StartupListener, HashSet`1 ScriptModuleAssemblies) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 156
UATHelper: Packaging (Android (ASTC)): (see C:\Users\EA-4090\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.1\Log.txt for full exception trace)
UATHelper: Packaging (Android (ASTC)): AutomationTool executed for 0h 0m 0s
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
PackagingResults: Error: Unknown Error

I am by no means well-versed with any of this, I have been scouring around here on the forums for a solution and attempting to impliment the changes but so far nothing is helping. Any ideas or advice to direct me towards a solution would be greatly appreciated :slight_smile: Thanks!

I’m not a mobile dev expert, but since no one else has responded and since I’ve been working my way around Android packaging problems for our project, I’ll suggest a couple of things to narrow down the problem. I’m working with UE 5.4.2 because this is a new project, so some things may vary.

  1. Are you able to package the project “by hand” from the UE Editor menu, then use the installation file that UE generates to install and run your app on a device? Right now my project works perfectly if I use this method, but UE’s automated launch is failing for me. The batch file will help you figure out if your problem is in packaging or in deployment.
  2. One of the messages in your log refers to another log for more detail. Although I’ve often found with this message that the other log contains the same output, it’s worth taking a look if you haven’t.
  3. Much of your log is call stack traceback, which introduces a lot of clutter that is only partially relevant. Try importing your log to a text editor and simply inserting some blank lines right before and right after each of those call stacks. Now look at the log right before the call stack begins to see what was going on at that point, then look at the first couple entries and the last couple entries of the stack (ignoring the middle stack levels). At one end of the stack you’ll often see an entry (or two) that are the exception handler being called to log the problem – these don’t tell you anything about the problem per se. So skip those and look where the problem happened. I also find it helpful to turn off word wrap in the text editor, using a horizontal scrollbar instead, so the log is displayed as “one entry in the log, one line on the screen.”
  4. This is a long shot, but you’ve got spaces and some special characters in the file path for the project. That may be causing problems if there’s something in the build tooling that doesn’t gracefully quote or escape the blanks and specials.

It looks as if you’ve got an automated build chain that will save you a lot of time when it works, but my advice right now would be to try packaging, installing, and running as three steps from the editor so you get a better idea of what’s really happening.

Looking at your logs, I think the “unknown error” is just an outer automation layer reporting that something failed down inside, and the outer layer doesn’t try to interpret what happened but rather assumes the inner layer(s) will have logged more information already.