2

I have an Ionic project that after upgrading to OSx Mojave, for some reason is not building anymore.

The project is built over Ionic 3.

I have Cordova CLI 7.0.0

When I run

ionic cordova run android

I get this error when trying to build:

* What went wrong:
Could not resolve all files for configuration ':debugCompileClasspath'.
> Could not find support-v4.aar (com.android.support:support-v4:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.aar

I tried changing build.gradle, downgrading cordova, upgrading cordova, tried with different android versions, but still the same issue.

Any ideas what might be wrong here?

Pablo
  • 1,145
  • 4
  • 18
  • 43
  • Possible duplicate of [Ionic 3 Android Build Error (could not find support-v4.jar)](https://stackoverflow.com/questions/52451055/ionic-3-android-build-error-could-not-find-support-v4-jar) – Sandy..... Oct 25 '18 at 19:50

3 Answers3

3

I'm currently not really sure what causes the issue but here's what helped me:

Look inside you build.gradle files under platforms/android and platforms/android/app and move jcenter() dependency to the bottom of the repositories.

repositories {
    maven {
        url "https://maven.google.com"
    }
    jcenter()
}
Gary Großgarten
  • 1,442
  • 8
  • 8
1

I also faced the same issue and fixed by workaround below. That works for me.
Change following lines in the file project.properties from your_project_folder\platforms\android

cordova.system.library.2=com.android.support:support-v4:25.+
cordova.system.library.3=com.android.support:appcompat-v7:25.+
Pradnya Sinalkar
  • 1,096
  • 4
  • 12
  • 26
1

I also faced this issue yesterday...

I do following changes in my build.gradle

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}

Just added jcenter() below maven

Shriniwas b
  • 326
  • 3
  • 12