Packaging for android fails with gradle error

Hello,
I had a project that worked fine with 4.18. After a while and updating to 4.20, I convert in place my project (bad idea) and I can’t manage to package it anymore. Not sure this has anything to do with the 4.20 but it was the main change.
It seems that the error is linked to gradle as I get:

:app:mergeDebugResourcesC:\Users\J?r?mie\.gradle\caches\transforms-1\files-1.1\play-services-base-11.8.0.aar\ed3fd0fb06d8d84f96fc82cb75dba62a\res\drawable\common_google_signin_btn_text_disabled.xml: error: file not found.
C:\Users\J?r?mie\.gradle\caches\transforms-1\files-1.1\play-services-base-11.8.0.aar\ed3fd0fb06d8d84f96fc82cb75dba62a\res\drawable-hdpi-v4\common_google_signin_btn_icon_dark_normal_background.png: error: file not found.

And this goes on for several files that exists. It ends with some AAPT2 error:

> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

After opening the log file, I read:

<>c.<PrintExceptionInfo>b__4_1: ==============================================================================
<>c.<PrintExceptionInfo>b__4_0: ERROR: cmd.exe failed with args /c "D:\UE4 Projects\Pumpat_Runner\Intermediate/Android/APK\gradle\rungradle.bat" :app:assembleDebug
<>c.<PrintExceptionInfo>b__4_0:        (see C:\Users\Jérémie\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+UE4+Projects+UE_4.20\Log.txt for full exception trace)
<>c.<PrintExceptionInfo>b__4_1: 
<>c.<PrintExceptionInfo>b__4_1: BuildException: cmd.exe failed with args /c "D:\UE4 Projects\Pumpat_Runner\Intermediate/Android/APK\gradle\rungradle.bat" :app:assembleDebug
<>c.<PrintExceptionInfo>b__4_1:    à UnrealBuildTool.UEDeployAndroid.RunCommandLineProgramWithException(String WorkingDirectory, String Command, String Params, String OverrideDesc, Boolean bUseShellExecute) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\Android\UEDeployAndroid.cs:ligne 1406
<>c.<PrintExceptionInfo>b__4_1:    à UnrealBuildTool.UEDeployAndroid.MakeApk(AndroidToolChain ToolChain, String ProjectName, TargetType InTargetType, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk, Boolean bDisallowExternalFilesDir) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\Android\UEDeployAndroid.cs:ligne 3838
<>c.<PrintExceptionInfo>b__4_1:    à UnrealBuildTool.UEDeployAndroid.PrepForUATPackageOrDeploy(FileReference ProjectFile, String ProjectName, DirectoryReference ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bIsDataDeploy) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\Android\UEDeployAndroid.cs:ligne 3990
<>c.<PrintExceptionInfo>b__4_1:    à AndroidPlatform.Package(ProjectParams Params, DeploymentContext SC, Int32 WorkingCL) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Android\AndroidPlatform.Automation.cs:ligne 403
<>c.<PrintExceptionInfo>b__4_1:    à Project.Package(ProjectParams Params, Int32 WorkingCL) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\PackageCommand.Automation.cs:ligne 37
<>c.<PrintExceptionInfo>b__4_1:    à BuildCookRun.DoBuildCookRun(ProjectParams Params) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:ligne 220
<>c.<PrintExceptionInfo>b__4_1:    à BuildCookRun.ExecuteBuild() dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:ligne 41
<>c.<PrintExceptionInfo>b__4_1:    à AutomationTool.BuildCommand.Execute() dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:ligne 112
<>c.<PrintExceptionInfo>b__4_1:    à AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:ligne 562
<>c.<PrintExceptionInfo>b__4_1:    à AutomationTool.Automation.Process(String[] Arguments, StartupTraceListener StartupListener) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:ligne 532
<>c.<PrintExceptionInfo>b__4_1:    à AutomationTool.Program.MainProc(String[] Arguments, StartupTraceListener StartupListener) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:ligne 174
<>c.<PrintExceptionInfo>b__4_1:    à AutomationTool.Program.<>c__DisplayClass1_0.<Main>b__0() dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:ligne 100
<>c.<PrintExceptionInfo>b__4_1:    à AutomationTool.InternalUtils.RunSingleInstance(Func`1 Main) dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:ligne 725
<>c.<PrintExceptionInfo>b__4_1:    à AutomationTool.Program.Main() dans D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:ligne 100
<>c.<PrintExceptionInfo>b__4_1: ==============================================================================
Program.Main: AutomationTool exiting with ExitCode=1 (Error_Unknown)

I tried the different solutions from:

From my project settings:

256023-android-sdk.jpg

I tried to package by disabling gradle and using ant (by unchecking the box: enable gradle instead of ant). The packaging then completes only if “For distribution” is unchecked. However, the compiled apk crashes right when opening.

If anyone have any idea, I’m more than willing to give it a shot.

Regards

It appears that it was simply that my $USER_HOME contains non valid characters. Creating a second user with proper characters allowed me to package properly. It don’t know which update (maybe from codeworks?) made this mess, but I found a way to make it works.

I have the same problem, but my path seems okay.

UATHelper: Packaging (Android (ETC2)): C:\Users\hello.gradle\caches\transforms-1\files-1.1\support-compat-27.1.0.aar\91d8725fb716b1145270400a7aae842d\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/fontStyle not found.
UATHelper: Packaging (Android (ETC2)): C:\Users\hello.gradle\caches\transforms-1\files-1.1\support-compat-27.1.0.aar\91d8725fb716b1145270400a7aae842d\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/font not found.
UATHelper: Packaging (Android (ETC2)): C:\Users\hello.gradle\caches\transforms-1\files-1.1\support-compat-27.1.0.aar\91d8725fb716b1145270400a7aae842d\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/fontWeight not found.
UATHelper: Packaging (Android (ETC2)): Z:\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:94: error: resource android:attr/fontStyle not found.
UATHelper: Packaging (Android (ETC2)): Z:\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:94: error: resource android:attr/font not found.
UATHelper: Packaging (Android (ETC2)): Z:\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:94: error: resource android:attr/fontWeight not found.
UATHelper: Packaging (Android (ETC2)): error: failed linking references.

I don’t understand what could be the problem. It was working fine all the time.

what did you do to make it work
and can you give me screenshot of sdkconfig after you did this

I have the same problem too with 4.21.1 and Codeworks 1R7. Exact same error in my log file. I tried deleting the license key and accept it. Didn’t help. My user home dir is fine. No special characters.

Has any one able to fix this. It’s like the blue screen of death. While Epic is enjoying the holidays we are going to enjoy fixing their creation.

I had a similar error. Added icon_round.png to /Intermediate/Android/arm64/res/drawable. (Just duplicated icon.png and renamed) Works fine.

1 Like