Unnati Patadia
Unnati Patadia

Reputation: 732

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException

Error While running command :
ionic cordova build android --prod --release

It perfectly works when I use ionic cordova run android

But when I tried to create release apk for deployment it gives an error :

  • What went wrong: FAILED 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 #2: Unexpected error during compile 'E:\Unnati\WorkSpace\gita\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.

  • 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 21s 20 actionable tasks: 1 executed, 19 up-to-date E:\Unnati\WorkSpace\gita\platforms\android\gradlew: Command failed with exit code 1 Error output: 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 #2: Unexpected error during compile 'E:\Unnati\WorkSpace\gita\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.

How to solve this?

Upvotes: 0

Views: 368

Answers (1)

Unnati Patadia
Unnati Patadia

Reputation: 732

It is solved by adding this in build.gradle:

allprojects {
    // Workaround for https://issuetracker.google.com/117900475
    // Remove when upgrading to AGP 3.4 or higher.
    configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
        config.resolutionStrategy.eachDependency { details ->
            details.useVersion("3.5.0-alpha03-5252756")
        }
    }
}

Upvotes: 1

Related Questions