Android build broken after gradle dependencies update: Execution failed for task ':processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

yay she works now, it is the maroun-background-location plugin that brought about the issue

this also worked for me. I also had to delete my /platforms/android/build directory to get past a DEX error.

I had the same problem.

I solved it change project.properties to version v4:26:

before:
cordova.system.library.1=com.android.support:support-v4:24.0.0+
cordova.system.library.2=com.android.support:support-v4:24+

after:
cordova.system.library.1=com.android.support:support-v4:26.0.0+
cordova.system.library.2=com.android.support:support-v4:26+

1 Like

We fixed that problem adding a hook which applies a fix to the build.gradle

This worked for me too! Thanks.

Using this approach, adding this cordova hook fixed the issue.
Adds it always to the end of gradle file.

hooks/androidAfterPrepare.js

module.exports = function(ctx) {
  var fs = ctx.requireCordovaModule('fs'),
    path = ctx.requireCordovaModule('path'),
    xml = ctx.requireCordovaModule('cordova-common').xmlHelpers;
  var gradlePath = path.join(ctx.opts.projectRoot, 'platforms/android/build.gradle');
  var gradleAppendedText = '\nconfigurations.all {\nresolutionStrategy.force \'com.android.support:support-v4:26.0.0\'\n}';

  fs.readFile(gradlePath, function read(err, data) {
    if (err) {
      throw err;
    }
    if(data.indexOf('com.android.support:support-v4:26.0.0') === -1){
      fs.appendFile(gradlePath, gradleAppendedText, function (err) {
        if (err) throw err;
      });
    }
  });

4 Likes

Is there any documentation how to include this hook?

Thanks a lot :slight_smile:

1 Like

I was looking for the same. Google gave me this, which works for me:

https://cordova.apache.org/docs/en/latest/guide/appdev/hooks/

1 Like

cordova-plugin-broadcaster was causing my problems.

Editing this plugin.xml line in the node_modules and plugin directory from
<framework src="com.android.support:support-v4:+" />
to
<framework src="com.android.support:support-v4:26+" />
and adding the android platform allowed me to build again.

I had same problem, but it work now by changed ‘com.android.support:support-v4:+’ to ‘com.android.support:support-v4:23+’ as you said.

I changed text in my '…platforms\android\phonegap-plugin-barcodescanner\my_project-barcodescanner.gradle

and then re-build by ionic cordova run android
it works. thank a lot.

This worked ! Thanks ! You gave me a great help.

problem find out: cordova-plugin-document-viewer

I have solved this problem. thank you so much.

Hello :slight_smile:

I have been working on this kind of error for days :disappointed_relieved:

The problem was the coexistence of cordova-plugin-crosswalk-webview and phonegap-plugin-push. They were using different versions of the com.android.support:support library (and it looks like the last release of android.support library breaks cordova builds).

I know that crosswalk webview is no longer maintained but it’s doing the job for now and I don’t want to remove it.

So I have updated my android studio and I have added cordova-android-support-gradle-release in my project (it chooses the right android support version for you :sunglasses:).

Now I am able to build releases like a charm :slight_smile:

I didn’t manage to build with cordova-android@6.4.0 (flavor issue, see this post to get ride of it : https://stackoverflow.com/questions/47413647/ionic-android-build-error-all-flavors-must-now-belong-to-a-named-flavor-dimen)

I hope that will help some people !

My infos :

cli packages: (C:\Users\***\Documents\***\***\mobile-app\node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v6.11.3
    npm               : 5.2.0
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\****\AppData\Local\Android\Sdk

Misc:

    backend : pro

Peace :kissing_heart:

2 Likes

In order to prevent android support v28 from being used and to fix this issue I used:

cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.0.0

Writing in build.gradle did the trick too, but as platform/android is built dynamically I preferred the 1st solution.

8 Likes

For the life of me I swear… well. your tip saved me, thanks lol

thx bro, you save my life.

thanks man, you save my life !

This worked for me. But now my app needs up to 5 min to build.

Encontrou alguma solução Guilherme? Estou quebrando a cabeça com isso a semanas.

what will happen if i remove the platform from the existing app? will this cause any changes in the existing app?