# Packaging for android fails with gradle error

**URL:** <https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281>\
**Category:** Mobile\
**Tags:** Android-Packaging, gradle, unreal-engine, packaging-projects, question\
**Created:** [October 9, 2018, 3:12am UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281 "2018-10-09T03:12:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shining\_Pear](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shining\_Pear](https://forums.unrealengine.com/u/Shining_Pear)\
**Post date:** [October 9, 2018, 3:12am UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281/1 "2018-10-09T03:12:48Z")

</div>

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:

> **[4.18 can't launch on the device when gradle is enabled instead of Ant!!!!!?](https://forums.unrealengine.com/questions/722165/418-cant-launch-on-the-device-when-gradle-is-enabl.html)**
>
> i can’t launch on the mobile using gradle instead of Ant here is apic of the log i can launch it if i disabled gradle i have accept the sdk license just one question is it necessary to fill this configSdk page in 4.18 in order to launch it? ...

> **[Error :app:mergeDebugResourceserror with gradle](https://forums.unrealengine.com/questions/822062/error-appmergedebugresourceserror-with-gradle.html)**
>
> Hello! I’m trying to use this Plugin: GitHub - PandoraEntertainment/Facebook: A plugin for Unreal Engine 4 that integrates the Facebook SDK. in my game, but when I try to package the game (plugin enabled), the package process crashes: LogPlayLevel:...

> **[Android packaging build fail - UE 4.18](https://forums.unrealengine.com/questions/720605/android-packaging-build-fail-ue-418.html)**
>
> Hello, I get the build file error below: UEDeployAndroid.MakeApk: ====31-10-2017 09:51:22====PERFORMING FINAL APK PACKAGE OPERATION================================================ UEDeployAndroid.CreateRunGradle: UEDeployAndroid.CreateRunGradle:...

From my project settings:

![256023-android-sdk.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/1/f61935abd54c2179213327b9b82a17acdcda5a14.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Shining\_Pear](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shining\_Pear](https://forums.unrealengine.com/u/Shining_Pear)\
**Post date:** [October 10, 2018, 4:19am UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281/2 "2018-10-10T04:19:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![smbv1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@smbv1](https://forums.unrealengine.com/u/smbv1)\
**Post date:** [December 19, 2018, 9:24pm UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281/3 "2018-12-19T21:24:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DarkLegendx5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DarkLegendx5](https://forums.unrealengine.com/u/DarkLegendx5)\
**Post date:** [February 9, 2019, 3:17pm UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281/4 "2019-02-09T15:17:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_73f403c6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_73f403c6](https://forums.unrealengine.com/u/anonymous_user_73f403c6)\
**Post date:** [February 12, 2019, 3:42pm UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281/5 "2019-02-12T15:42:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_451ef1c5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_451ef1c5](https://forums.unrealengine.com/u/anonymous_user_451ef1c5)\
**Post date:** [June 10, 2019, 9:13pm UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281/6 "2019-06-10T21:13:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![himitsuroot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/himitsuroot/32/88708_2.png) [@himitsuroot](https://forums.unrealengine.com/u/himitsuroot)\
**Post date:** [November 19, 2021, 6:02pm UTC](https://forums.unrealengine.com/t/packaging-for-android-fails-with-gradle-error/435281/7 "2021-11-19T18:02:41Z")

</div>

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