0

I am new to Android. I built a simple login activity (just created it) and it my project is giving this error:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:29.+.

I tried these solutions and they didnt work:

https://stackoverflow.com/questions/51218535/unable-to-resolve-dependency-for-appdebug-compileclasspath-could-not-resolv

https://stackoverflow.com/questions/47001656/unable-to-resolve-dependency-android-studio-3-0

My app gradle looks like this:

apply plugin: 'com.android.android'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {

        minSdkVersion 15
        targetSdkVersion 29
        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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:29.+'
    implementation 'com.android.support:design:29.+'
    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'
}

This is gradle app

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.20'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

I don't understand how to resolve this issue considering I haven't even added question of my own. Please explain your solution step by step so I'm able to recreate to since this is literally the first project I created.

Fatima Arshad
  • 119
  • 1
  • 9
  • It's because there is no support version 29.+. The last version is 28.0.0. The easiest way to update your project is by changing all the 29+ version including compile and buildTools to version 28.0.0, then choose menu `Refactor -> Migrate to AndroidX` – ישו אוהב אותך Dec 21 '19 at 13:20

3 Answers3

0

1 just figured out how to remove this Gradle error, follow the following steps.

  1. Go to "File".
  2. Click on Invalidate Cache/ Restart.
  3. Again click on Invalidate Cache / Restart(On dialog window).

Let the Gradle build without any interruption

or

2 open the app. go to gradle scripts. then build.gradle(module:app) finally inside dependecies type ( implementation 'com.android.support:appcompat-v7:27.+' )

0

When you are using

   compileSdkVersion 29
    buildToolsVersion "29.0.2"

Change

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

To

implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'

because google has changed the support libraries for androidX

in app gradle change

apply plugin: 'com.android.android'

to

apply plugin: 'com.android.application'
Amanpreet Kaur
  • 440
  • 6
  • 13
0

I deleted and reinstalled my android studio. The only thing that worked for me

Fatima Arshad
  • 119
  • 1
  • 9