After trying to build APK once and fixing an error, I got an error executing ./gradlew assembleRelease
again: Execution failed for task ':app:mergeReleaseResources' building APK

- 2,172
- 2
- 18
- 28
7 Answers
The problem occured becaused when I tried to build once, it has created drawables dirs on android/app/src/main/res/
. Then when I tried on second time, it has shown me this error Execution failed for task ':app:mergeReleaseResources' building APK
I just deleted the drawable-* dirs and it worked.
Hope it helps!
rm -rf android/app/src/main/res/drawable-*

- 2,172
- 2
- 18
- 28
-
8Won't this delete all your app icons and any assets you have in there? – Taylor A. Leach Jul 07 '20 at 21:31
-
@TaylorA.Leach No! It won't delete app icons. App icons are stored in the same folder with the folder name mipmap. – cmcodes Sep 11 '20 at 15:26
-
1Now it's giving `A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade' Error because images inside drawable are missing – Zeeshan Ahmad Khalil Jul 31 '21 at 13:23
-
AAPT: error: resource mipmap/ic_launcher (aka com.myApp.myapp:mipmap/ic_launcher) not found. – Thulfiqar Nov 21 '22 at 06:11
As addition to accepted answer, if there is a "raw" folder in the same directory, also you must delete that.

- 445
- 4
- 7
-
1This is a good point to take into account. I only solved erasing this folder too. – Luighi Viton-Zorrilla Jan 10 '21 at 05:31
I just deleted the drawable-* dirs as well raw dir from
android/app/src/main/res/ and it worked.

- 377
- 4
- 7
Exactly problem occurred when I tried to build once, it has created drawable dirs. I was facing following issue:
Execution failed for task ':app:mergeReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #0: Unexpected error during compile 'E:\project\ionic\uvparentlan0.4\platforms\android\app\src\main\res\drawable-land-xxxhdpi\screen.png', attempting to stop daemon. This should not happen under normal circumstances, please file an issue if it does.
Solution: I delete all drawable directories named "drawable-port-*****"
Now Build again " ionic cordova build --release android "
BUILD SUCCESSFUL in 1m 11s 42 actionable tasks: 40 executed, 2 up-to-date Built the following apk(s):

- 81
- 1
- 5
Sometimes it's a result of a duplicate file. Reading the error log, it seemed that I had a duplicate file name (two files with the same name). The issue resolved by removing one of the files (from a previous build if I remember it right).

- 596
- 1
- 7
- 17
If you are facing this error from
\android\app\src\main\res\mipmap-xxxhdpi\splash.png
change it to jpg
extension
\android\app\src\main\res\mipmap-xxxhdpi\splash.jpg

- 3,227
- 8
- 13
- 23

- 1
- 2