Pablo
Pablo

Reputation: 1141

Ionic - Could not find support-v4.aar (com.android.support:support-v4:26.1.0)

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?

Upvotes: 2

Views: 1488

Answers (4)

Gheyath Nasani
Gheyath Nasani

Reputation: 190

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

}

Upvotes: 0

Shriniwas b
Shriniwas b

Reputation: 336

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

Upvotes: 1

Pradnya Sinalkar
Pradnya Sinalkar

Reputation: 1146

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.+

Upvotes: 1

Gary Großgarten
Gary Großgarten

Reputation: 1592

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()
}

Upvotes: 4

Related Questions