Encountering a similar issue, I built on Friday without any trouble but faced an error 'Execution failed for task': app: processDebugResources' when attempting the build on Monday. The error included a stacktrace on Aapt2Exception: AAPT2 error.
It seems that this problem is related to Google releasing new versions of support-v4 and api-level updates.
According to this source, installing the cordova-android-support-gradle-release plugin can resolve the issue.
Add the following code snippet in the build.gradle file located in the platforms/android directory:
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:27.1.0'
}
While this solution didn't work for me, there might have been an error in my implementation. Hopefully, it resolves your issue.
--- UPDATE 1
Google recently updated the Google Play service libraries and Firebase on June 17, 2019, which could be directly linked to our problem. They suggest the following modifications:
- Upgrade com.android.tools.build:gradle to v3.2.1 or higher.
- Increase compileSdkVersion to 28 or later.
- Transition your app to use Jetpack (AndroidX); follow the guidelines in Migrating to AndroidX.
In the case of Cordova applications, implementing these changes may not be straightforward, especially during a release cycle update. This situation can be frustrating.
--- UPDATE 2
To address the issue temporarily, I edited the project.properties file within the platforms/android directory.
I revised all the libraries marked with "+" to a specific version before the one released on the 17th. Refer to this link, although this method is not ideal as the file might get deleted during platform removal and re-inclusion.
--- UPDATE 3
As pointed out by Leonardo, this issue arises due to the updates in firebase and play service libraries alongside automatic cordova dependency updates. Resolving this involves using the configurations.all code in a build-extras.gradle file at the project's root directory + employing hooks for automating the setup copy to the platform/android directory as detailed in this resource.
PS: Apologies for any grammatical errors in English.