114

Running a project in Android Studio fails with this error: could not find any version that matches com.android.support:appcompat-v7:+

How can I fix this error?

MohanKumar
  • 960
  • 10
  • 26
ArdaZeytin
  • 1,324
  • 3
  • 13
  • 21
  • 1
    Actually this is the answer that works for me: http://stackoverflow.com/a/18900369/1038702 – David Dec 25 '13 at 17:50

12 Answers12

195

From Android Studio go to: Tools >> Android >> SDK Manager

Select and install "Extras|Android Support Repository"

Halil
  • 1,795
  • 1
  • 24
  • 39
James Edgar
  • 1,976
  • 1
  • 12
  • 4
  • 16
    +1 and worth noting that this is not the same as "Android Support Library"... You will want the "Android Support Repository" – dwerner Aug 08 '14 at 04:45
  • I've spent 2 days trying to fix the error. I realise from the start I didn't download the `support repository`, just saw your post a moment ago, then downloading. Problem solved ! thanks – Azizi Musa Oct 16 '14 at 04:22
  • 7
    My support repository version 12 is installed, and I'm still getting this error. – IgorGanapolsky Apr 17 '15 at 06:11
  • 1
    Thanks! This also fixed a problem for me with PhoneGap where an `cordova build android` was throwing a similar error! – Giel Berkers Aug 07 '15 at 12:53
  • 1
    The name has changed to "Local Maven repository for Support Library" (v28) – n00dl3 Mar 18 '16 at 08:50
  • Tools >> Android >> SDK Manager >> SDK Tools >> Android Support Repository for AndroidStudio 2.1 – KunMing Xie Jul 22 '16 at 01:20
  • 4
    The UI has changed enough that these answers no longer work (Android Studio 3.+). Sigh. – SMBiggs Jul 22 '18 at 21:26
23

For me it worked after changing the version from 7:27.+ to 7:+

osama yaccoub
  • 1,884
  • 2
  • 17
  • 47
  • wow ... great ... for me when add camera plugin this error occured then resolved when compile "com.android.support:support-v4:27+" to compile "com.android.support:support-v4:+" – saber tabatabaee yazdi Sep 12 '19 at 07:22
  • It worked for me also.. I tried invalidating cache and adding maven to build.gradle but nothing worked. Now just changed version 7:30.+ to 7:+ worked... Thanks a lot Osama yaccoub – Jilson P Jose Sep 17 '20 at 09:48
18

In Project > app > build.gradle file replace the line

implementation 'com.android.support:appcompat-v7:+'29.+'

with

implementation 'com.android.support:appcompat-v7:+'

and line

implementation 'com.android.support:design:29.+'

with

implementation 'com.android.support:design:+'

Then clean build

Petronella
  • 2,327
  • 1
  • 15
  • 24
14

Also as as said on How to update Android platform-tools in a headless linux?

 android list sdk

 android update sdk --no-ui --filter extra
Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
11

It is very simple. Kindly update and replace the below code in build.gradle(Project :App Name).

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
Ananta Prasad
  • 3,655
  • 3
  • 23
  • 35
  • This works for Gradle-based projects, although it doesn't help so much if you're running `aapt`, `javac` and `dx` manually without Gradle. – Silas S. Brown Feb 26 '20 at 18:27
3

After installing Extras|Android Support Repository, It does not work for me. Then I change v7:1.6 to v7:1.8 in the app build.gradle file.

com.android.support:appcompat-v7:1.8.+! and It works for me.

Flimm
  • 136,138
  • 45
  • 251
  • 267
cbyniiaii
  • 91
  • 7
0

Open SDK Manager.exe in your Android Studio folder and install a matching API.

Zulakis
  • 7,859
  • 10
  • 42
  • 67
0

I found all these answers incorrect for me. Instead in your android studio look below on the left. There will be some help for this.

For example, you will notice This support library should not use a different version (32) than the compilesdkVersion (23)

Then you change the version of to 23 like this

compile 'com.android.support:support-v4:23'

Now, you will see a message A newer version of com.android.support-v4 than 23 is available 23.4.0.

Thats how I knew that the correct version is 23.4.0

Siddharth
  • 9,349
  • 16
  • 86
  • 148
0

If you see this after you've just created a new project in Intellij then try to recreate it again with "Use AndroidX artifacts" checked

ITisha
  • 902
  • 2
  • 12
  • 14
0

To whom came here for same error but version 29, change your support library to version 28:

build.gradle(app):

dependencies {
    ...
    implementation 'com.android.support:appcompat-v7:28.+'
    ...
}

None of googled solutions worked for me. Then I saw Android has only support library up to version 28. It is weird that I got this error in an out-of-box created Android Studio project.

I'm not sure which Android Studio version was, cause I upgraded Studio after got error. Now in Android Studio 3.6.3, new projects coming with 'androidx.appcompat:appcompat:1.0.2'.

Kuvalya
  • 1,094
  • 1
  • 15
  • 26
0

This worked for me to build and run this project. I had to add google in both sections.

build.gradle (project)

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

build.gradle(app)

apply plugin: 'com.android.application'



android {
    compileSdkVersion 26
    buildToolsVersion "29.0.2" //25.0.2"
    defaultConfig {
        applicationId 'com.github.nkzawa.socketio.androidchat'
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    ////noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:25.0.+'
    ////noinspection GradleCompatible
    implementation 'com.android.support:recyclerview-v7:25.0.+'
    implementation ('io.socket:socket.io-client:0.8.3') {
        exclude group: 'org.json', module: 'json'
    }

    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testImplementation 'junit:junit:4.12'
}
MPV
  • 337
  • 3
  • 10
  • To build and run this project: https://github.com/nkzawa/socket.io-android-chat – MPV Feb 13 '21 at 02:31
0

Got the same error but version 26.

Downloading the libraries through the SDK Manager is no longer supported. The support libraries are now available through Google's Maven repository.

Solution:

In build.gradle (project) inside both buildscript/repositories and allprojects/repositories add this:

maven {
            url 'https://maven.google.com/'
            name 'Google'
        }

Result:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

It worked for me.