Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve: com.android.support:recyclerview-v7:28.1.1

I am trying to use a RecyclerView and I added the line implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3' to my build.gradle (app) but it gives the error Failed to resolve: com.android.support:recyclerview-v7:28.1.1 I have seen other answers suggest adding

allprojects {
    repositories {
        google()
        jcenter()
    }
}

to the build.gradle file but it was already in there and has not helped. All my SDK tools are installed and up to date.

build.gradle(Project):

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

ext {
    roomVersion = '1.1.1'
    archLifecycleVersion = '1.1.1'
}

build.gradle(App):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.findmyitem"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:recyclerview-v7:28.1.1'
}
like image 341
Tori Harris Avatar asked Nov 28 '22 21:11

Tori Harris


2 Answers

That's because there is no 28.1.1 version. The latest one is 28.0.0 so use that. Add this:

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

instead of:

implementation 'com.android.support:recyclerview-v7:28.1.1'

You can check the latest version or all the versions ever released here

Update:

Android is moving away from Android AppCompat Library to Androidx. Going forward you should ideally use these libraries as all the new updates will be for them. To use it include

implementation 'androidx.appcompat:appcompat:1.2.0'

and instead of

implementation 'com.android.support:recyclerview-v7:28.1.1'

use

implementation 'androidx.recyclerview:recyclerview:1.1.0'

for recyclerview.

Again, You can check the latest version or all the versions ever released of Androidx Appcompat here

like image 196
Jacob Celestine Avatar answered Dec 04 '22 18:12

Jacob Celestine


Instead of

implementation 'com.android.support:recyclerview-v7:28.1.1'

update it to

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

Latest one is 28.0.0

Most probably 28.0.0 might be the last version of the old support libraries, after that migrate your existing project to AndroidX.

AndroidX provides all the features of the support libraries, in a collection of independently versioned libraries. Google can now release a new version of one component, without having to update the entire support library.

like image 38
Rakhi Dhavale Avatar answered Dec 04 '22 19:12

Rakhi Dhavale