My project is located in the default project directory
C:\Users\adnan\Documents\Unreal Projects\MyGame
I have AAB packaging enabled, and I build the game (by clicking “Launch” inside the editor), everything works, the game launches and the AAB is generated inside the build directory.
I copy & paste the same project to another dir:
C:\Users\adnan\Documents\Unreal Projects\MyGame2
And do the same, build fails. Same issue happens when I build using CLI and from a “clean” project (no intermediate directory etc)
What I think went wrong:
Based on the error in the log below, the issue is that the gradle directory isn’t generated inside Intermediate\Android\gradle (this directory is empty)
In both attempts I’m using the same UE4 installation and configuration, and the same android build tools (NDK and SDK).
When it doesn’t work, I get this error in the build log:
Creating rungradle.bat to work around commandline length limit (using unused drive letter V:)
Writing symbols to C:\Users\adnan\Documents\Unreal Projects\build\Binaries/Android\OrcsAndHumans_Symbols_v3/OrcsAndHumans-arm64\libUE4.so
Fixing minSdkVersion; requires minSdkVersion of 21 for App Bundle support
Fixing minSdkVersion; requires minSdkVersion of 21 for App Bundle support
ERROR: Unhandled exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\adnan\Documents\Unreal Projects\build\Intermediate\Android\gradle\app\abi.gradle'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
at UnrealBuildTool.UEDeployAndroid.MakeApk(AndroidToolChain ToolChain, String ProjectName, TargetType InTargetType, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, UnrealTargetConfiguration Configuration, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk, Boolean bDisallowExternalFilesDir, Boolean bSkipGradleBuild) in D:\Build\++UE4+Licensee\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\Android\UEDeployAndroid.cs:line 4143
at UnrealBuildTool.UEDeployAndroid.PrepTargetForDeployment(TargetReceipt Receipt) in D:\Build\++UE4+Licensee\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\Android\UEDeployAndroid.cs:line 4347
at UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile) in D:\Build\++UE4+Licensee\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 384
at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) in D:\Build\++UE4+Licensee\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 219
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\Build\++UE4+Licensee\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 550
Took 28.2069995s to run UnrealBuildTool.exe, ExitCode=6
UnrealBuildTool failed. See log for more details. (C:\Users\adnan\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+UE_4.25\UBT-OrcsAndHumans-Android-Shipping.txt)