javaandroidandroid-support-libraryandroidxappcompatactivity

Failed to resolve: com.android.support:support-v4:30.0.0


It Shows: Failed to resolve: com.android.support:support-v4:30.0.0 Add Google Maven repository and sync project Show in Project Structure dialog Affected Modules: app

build.gradle(:app):

apply plugin: 'com.android.application'

android { compileSdkVersion 30 buildToolsVersion '30.0.2'

defaultConfig {
    applicationId "com.example.android.miwok"
    minSdkVersion 15
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:appcompat-v7:30.0.0'
    implementation 'com.android.support:support-v4:30.0.0'
    implementation 'com.android.support:design:30.0.0'
}

Solution

  • Use the androidx library mostly you need to use this now:

    To use this you need to add Androidx support to your project if it is not migrated to Androidx.

    You can find here how to migrate project to Androidx.

    implementation 'androidx.appcompat:appcompat:1.2.0'
    

    or use the last support library:

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

    It is because the support libraries you trying to use don't exist.

    For Add Google Maven repository and google() do this inside build.gradle which outside of app directory.

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