Ionic v1 build error: android.support.v4 does not exist

For some reason I had to return back to make a quick build from v1 source. Once I added cordovaSocialSharing the build process error-ed out on
:compileDebugJavaWithJavac [path_to_my_project]\platforms\android\src\nl\xservices\plugins\FileProvider.java:4: error: package android.support.v4.content does not exist.

Long story short for some reason (newer versions of Android SDK is not propagated to the project) all the build process is ruined and you are stuck. There is several manuals how to fix the build process inside the Android studio, but we are about the edit the build files manually.

  1. Make sure you have installed Android Support Library (and Repository) inside your SDK manager (very bottom of the list in the branch Extras)
  2. In you project find /platforms/android/build.gradle and inside it locate the section dependencies {} somewhere around line 240.
  3. Add line compile 'com.android.support:support-v4:+'
  4. Save the file and start $ ionic build android again

Hope it can save a scarce day of someones life.
Fix is based on http://stackoverflow.com/a/28660443/1271285

2 Likes

It saves my whole day
thanks !!!