Piyush Bairagi
Piyush Bairagi

Reputation: 63

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

I am beginner and getting this error in Android Studio :-

Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:30.0.0 Install Repository and sync project
Show in File
Show in Project Structure dialog

And here is my gradle code :-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.0"
    defaultConfig {
        applicationId "com.example.piyushbairagi.demoapp"
        minSdkVersion 15
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:30.0.0'
    testCompile 'junit:junit:4.12'
}

I am using Android Studio 2.2.1 version for learning purpose. Any help will really be appreciated.

Upvotes: 5

Views: 29169

Answers (5)

reza star
reza star

Reputation: 1

This error is probably due to the fact that you do not have the updated Gradle and sdk installed in Android Studio. You must be install updated version of those or change targetsdk version and sdk version and compile appcompact to The version of you installed in pc as picture.enter image description here

Upvotes: 0

The Master Coder
The Master Coder

Reputation: 1

Generally, the problem is about your sdk version just check it may correspond to your dependencies version 27.+ or 26.0 etc ....

Just check the version of your sdk it may correspond to the needed version for your app like in this picture

enter image description here

enter image description here

Upvotes: -1

Tahreem
Tahreem

Reputation: 91

android.useAndroidX=true
android.enableJetifier=true

You can add these to the gradle.properties file and this shall work fine. I had the same issue and adding these removed the error. Also try updating all the plugins and components of the Android studio.

Upvotes: 8

guipivoto
guipivoto

Reputation: 18687

Latest version available for Support Libraries is 28.0.0.

So, you must update your build.gradle as follows:

compile 'com.android.support:appcompat-v7:28.0.0'

Support library was discontinued. So, don't expect any new release after 28.0.0.

Google is now supporting AndroidX. In a certain (and basic) way, is the same thing. So, you may want to consider to migrate your app to Android X in order to get support from Google.

More info about Android X:

https://developer.android.com/jetpack/androidx/migrate

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 365148

It happens because the support libraries v.30 don't exist.

Use the androidx library:

implementation 'androidx.appcompat:appcompat:1.1.0'

or use the last support library:

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

Upvotes: 9

Related Questions