[Solved] Execution failed for task ':app:mergeReleaseResources' when doing --release --prod build

Hey All

I am having a problem when trying to do a release build for my Android App so that I can upload it to the Play Store. When I run the following command: ionic cordova build --release --prod android I get the following error '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 #7: Unexpected error during compile ‘C:\projects…\platforms\android\app\src\main\res\drawable-port-xxxhdpi\screen.png’, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.’

From what I have been able to find on the web, this is due to the splash image being to large. please see the following -https://stackoverflow.com/questions/56450884/execution-failed-for-task-appmergereleaseresources-when-using-ionic-build-wi

Has anybody encountered this issue before and how could I resolve it?

Full terminal output from failure on wards:
FAILURE: Build failed with an exception.

  • What went wrong:
    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 #7: Unexpected error during compile ‘C:\projects…\platforms\android\app\src\main\res\drawable-port-xxxhdpi\screen.png’, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 19s
Exception in thread “ForkJoinPool.commonPool-worker-0” java.lang.IllegalStateException: AAPT Process manager cannot be shut down while daemons are in use
at com.android.builder.internal.aapt.v2.Aapt2DaemonManager.shutdown(Aapt2DaemonManager.kt:96)
at com.android.build.gradle.internal.res.namespaced.RegisteredAaptService.shutdown(Aapt2DaemonManagerService.kt:61)
at com.android.build.gradle.internal.workeractions.WorkerActionServiceRegistry$shutdownAllRegisteredServices$1$1.run(WorkerActionServiceRegistry.kt:96)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
32 actionable tasks: 30 executed, 2 up-to-date
C:\projects…\android\gradlew: Command failed with exit code 1 Error output:
Note: C:\projects…\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong:
    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 #7: Unexpected error during compile ‘C:\projects…\platforms\android\app\src\main\res\drawable-port-xxxhdpi\screen.png’, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 19s
Exception in thread “ForkJoinPool.commonPool-worker-0” java.lang.IllegalStateException: AAPT Process manager cannot be shut down while daemons are in use
at com.android.builder.internal.aapt.v2.Aapt2DaemonManager.shutdown(Aapt2DaemonManager.kt:96)
at com.android.build.gradle.internal.res.namespaced.RegisteredAaptService.shutdown(Aapt2DaemonManagerService.kt:61)
at com.android.build.gradle.internal.workeractions.WorkerActionServiceRegistry$shutdownAllRegisteredServices$1$1.run(WorkerActionServiceRegistry.kt:96)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android --release exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

Ionic Info:

Ionic:
Ionic CLI : 5.2.3 (C:\Users…Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.5.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

Cordova:
Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : not available
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 19 other plugins)

Utility:
cordova-res : 0.6.0
native-run : 0.2.8

System:
NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

Excuse me, is the problem solved?

Try this post: https://stackoverflow.com/a/54615423

it worked for me

Thanks @oluwaetosin2, it solved the problem for me as well :clap::clap::clap:

Hey @hvantao

Check the answer below by @oluwaetosin2. It solved the issue for me :slight_smile:

ohhhhhhhhhhh , thank @EuanDScott @oluwaetosin2
This problem has plagued me for a few days.
:heart::heart::heart: