Dependecies for CardView and RecyclerView in SDK version 28

I am trying to add CardView and RecyclerView dependencies in my Android Studio Project for SDK version 28. Upon building the project, I get the message, "Gradle Project Sync Failed. Basic Functionality will not work properly".

build.gradle(Module:app) file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.kavyabarnadhyahazarika.quarterallotmentiocl"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
       }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
buildToolsVersion '28.0.0'
          }

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    testImplementation 'junit:junit:4.12'
}

Error Messages: Failed to resolve: com.android.support:cardview-v7:28.0.0 Failed to resolve: com.android.support:recyclerview-v7:28.0.0

I have tried both build and clean project.

Also if these dependencies are not supported on SDK version 28, how do I resolve the issue?

Upvotes: 2

Views: 25992

Answers (3)

eyajosh
eyajosh

Reputation: 61

Here's a working solution.

replace the following dependencies

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

or

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

with the below implementations

implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'

I hope it helps.

Upvotes: 3

Cels
Cels

Reputation: 1334

This works for me.

// RecyclerView
implementation 'com.android.support:recyclerview-v7:+'

// CardView
implementation 'com.android.support:cardview-v7:+'

Upvotes: 3

ianhanniballake
ianhanniballake

Reputation: 200030

There is no 28.0.0 final release as of yet - just like your appcompat-v7 dependency, cardview-v7 and recyclerview-v7 should have a version of 28.0.0-alpha3:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:cardview-v7:28.0.0-alpha3'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'

Upvotes: 6

Related Questions