Skip to content

Instantly share code, notes, and snippets.

@ylno
Created March 8, 2018 09:37
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ylno/1a5933a1cd204d6ec450da28a6b528dc to your computer and use it in GitHub Desktop.
Save ylno/1a5933a1cd204d6ec450da28a6b528dc to your computer and use it in GitHub Desktop.
#!/bin/sh
if grep -q "com.android.support:support-v4:26.0.0" platforms/android/build.gradle; then
echo "build.gradle already fixed"
else
echo "configurations.all {\nresolutionStrategy.force 'com.android.support:support-v4:26.0.0'\n}" >> platforms/android/build.gradle
echo "android platform fixed"
fi
@ylno
Copy link
Author

ylno commented Mar 8, 2018

This is a fix for ionic if you get a building problem in android like:

  • What went wrong:
    Execution failed for task ':processDebugResources'.

com.android.ide.common.process.ProcessException: Failed to execute aapt

You can find more about this problem in this thread: https://forum.ionicframework.com/t/android-build-broken-after-gradle-dependencies-update-execution-failed-for-task-processdebugresources-com-android-ide-common-process-processexception-failed-to-execute-aapt/109982

How to use
Add this file to hooks/after_platform_add/010_fix_gradle.sh. It will fix this problem if you remove and add the platform:
ionic cordova platform remove adroid ionic cordova platform add android

Please check regularly if you still need this fix or if the cordova build is fixed.

@josmar-leite
Copy link

Good afternoon,
Can you describe in more detail the folder, file and command that I should change?

@beck24
Copy link

beck24 commented Jun 7, 2018

This issue has wasted many hours - your solution worked for me, just wanted to say thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment