46

When I use com.android.support:appcompat-v7:28.+ in my project's build.gradle(module) it works without any error. But when I just use com.android.support:appcompat-v7:28, just without .+, it gives me an error:

Failed to resolve: com.android.support:appcompat-v7:28.0

Just without the .+ end of it. I added maven before but the result was the same. Any idea to solve it?

Sourabh
  • 8,243
  • 10
  • 52
  • 98
رضا پریور
  • 556
  • 1
  • 6
  • 16

9 Answers9

56

28.0.0 is the final version of support libraries. Android has migrated to AndroidX. To use the latest android libraries, Migrating to AndroidX


Edit: Versions 28.0.0-rc02 and 28.0.0 are now available.

I don't see any 28.0 version on Google Maven. Only 28.0.0-alpha1 and 28.0.0-alpha3. Just change it to either of those or how it was previously, i.e., with .+ which just means any version under 28 major release.

For an alpha appcompat release 28.+ makes more sense.

Sourabh
  • 8,243
  • 10
  • 52
  • 98
  • 4
    everything was fine once I update android studio I started facing same error today. Any update? – Abdul Waheed Oct 23 '18 at 08:38
  • 8
    I've set `implementation 'com.android.support:appcompat-v7:28.0.0'` and I still get `Could not resolve com.android.support:appcompat-v7:28.0.0.` error – Ghasem Dec 19 '18 at 09:16
  • 1
    make sure `google()` is added in `repositories` in `android/build.gradle` – Sourabh Sep 05 '19 at 07:14
34

Add the following code on build.gragle (project) for adding Google maven repository

allprojects {
    repositories {
    ...
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    ...
    }
}
Vinil Chandran
  • 1,563
  • 1
  • 19
  • 33
  • But [here](https://developer.android.com/topic/libraries/support-library/setup) clearly states that you should you this if your gradle version is under 4.1 – Ghasem Dec 19 '18 at 08:37
20

some guys who still might have the problem like me (FOR IRANIAN and all the coutries who have sanctions) , this is error can be fixed with proxy i used this free proxy for android studio 3.2 https://github.com/freedomofdevelopers/fod just to to Settings (Ctrl + Alt + S) and search HTTP proxy then check Manual proxy configuration then add fodev.org for host name and 8118 for Port number

Screenshot of proxy settings in android studio

Emad
  • 465
  • 5
  • 9
13

As @Sourabh already pointed out, you can check in the Google Maven link what are the packages that Google has listed out.

If you, like me, are prompted with a similar message to this Failed to resolve: com.android.support:appcompat-v7:28.0, it could be that you got there after upgrading the targetSdkVersion or compileSdkVersion.

What is basically happening is that the package is not being found, as the message correctly says. If you upgraded the SDK, check the Google Maven, to check what are the available versions of the package for the new SDK version that you want to upgrade to.

I had these dependencies (on version 27):

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'

And I had to change the SDK version and the rest of the package number:

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

Now the packages are found and downloaded. Since the only available package for the 28 version of the SDK is 28.0.0 at the moment of writing this.

xarlymg89
  • 2,552
  • 2
  • 27
  • 41
  • For me it seemed that I need to only add 'com.android.support:support-v4:28.0.0' then 'com.android.support:appcompat-v7:28.0.0' would stop complaining. – Jonas Feb 13 '19 at 15:02
4

Run

gradlew -q app:dependencies

It will remove what is wrong.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Gank
  • 4,507
  • 4
  • 49
  • 45
2

my problem was just network connection. using VPN solved the issue.

Mahdieh Shavandi
  • 4,906
  • 32
  • 41
1

implementation 'com.android.support:appcompat-v7:28.0' implementation 'com.android.support:support-media-compat:28.0.0' implementation 'com.android.support:support-v4:28.0.0' All to add

  • Thank you for this code snippet, which might provide some limited, immediate help. A [proper explanation](https://meta.stackexchange.com/q/114762/349538) would greatly improve its long-term value by showing why this is a good solution to the problem and would make it more useful to future readers with other, similar questions. Please [edit] your answer to add some explanation, including the assumptions you’ve made. – Dwhitz May 22 '19 at 13:13
1

Ensure that your buildToolsVersion version tallies with your app compact version.

In order to find both installed compileSdkVersion and buildToolsVersion go to Tools > SDK Manager. This will pull up a window that will allow you to manage your compileSdkVersion and your buildToolsVersion.

To see the exact version breakdowns ensure you have the Show Package Details checkbox checked.

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3" (HERE)
    defaultConfig {
        applicationId "com.example.truecitizenquiz"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0' (HERE)
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
jsonknightlee
  • 173
  • 1
  • 12
Collins USHI
  • 567
  • 7
  • 17
0

in build.gradle , the version of bellow line should be same

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0'
kavakeb
  • 19
  • 1
  • 1
  • 6