0

I am building Ionic project for android using cordova. I am running into following error.

Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: 
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 
aapt2-3.3.0-5013011-windows Daemon #5: Daemon startup failed

I pretty much tried all the solution recommended and none of them worked in my case. I cant even read the log file. Same project I can able to build in macos.

Things I have tried.

  • Updated the Gradle to 5.4.1

  • remove and added android project

  • ionic cordova platform remove android
  • ionic cordava platform add android

Updated android studio to 3.4.1

added resolutionStrategy to in platform\android\build.gradle

configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:27.1.0'
}

added android.enableAapt2=false in gradle.properties

added com.android.support:support-v4:27.1.0 in project.properties

Error message I got

Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: 
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 
aapt2-3.3.0-5013011-windows Daemon #0: Daemon startup failed

command i used to build the project: ionic cordova run android

  • Cordova version 9.0.0
  • ionic version 5.0.0
  • angular version 4.4.3
user3543888
  • 85
  • 1
  • 8

2 Answers2

1

try this in your app level gradle file inside dependencies

dependencies {
    .....
    configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
    config.resolutionStrategy.eachDependency { details ->
        details.useVersion("3.3.2-5309881")
    }
}
}

this works for me

PPD
  • 5,660
  • 12
  • 52
  • 86
0

Try this:

   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")
        }
    }
}

Repo: Michel Gammelgaard

bipoza
  • 131
  • 3
  • 5
  • I tried that as well,but didn't work. BUILD FAILED in 1s C:\Git_Projects\mobile\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:mergeDebugResources'. > java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.5.0-alpha03-5252756-windows Daemon #0: Daemon startup failed – user3543888 Jun 05 '19 at 13:22