Search code examples
androidandroid-studioandroid-support-libraryandroid-appcompatandroidx

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.


Solution

  • 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'