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,173
  • 4
  • 18
  • 46
  • 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

4 Answers4

4

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,522
  • 9
  • 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,116
  • 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
  • 13
0

I faced this issue with ionic 5 - cordova, and I have sloved this by remove this line implementation "com.android.support:support-v4:26.+" in build.gradle(Module:android.app) > dependencies

dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
implementation "com.android.support:support-v4:27.+"
//implementation "com.android.support:support-v4:26.+"
// SUB-PROJECT DEPENDENCIES END

}

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 03 '22 at 02:45