Rashedur Rahman
Rashedur Rahman

Reputation: 359

Cannot import import android.support.v7.widget.RecyclerView;

While learning about RecyclerView, I am facing some problem. GreenAdapter Class failed to import “android.support.v7.widget.RecyclerView”. I am using Android Studio 3.1.4. My compile SDK Version is 28. Here's my build.gradle File:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28



    defaultConfig {
        applicationId "com.example.sunshine.sunshine.app"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"


    }

    buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
    }

}

dependencies {
    implementation project(':sunshinemodule')
    implementation project(':base')

    implementation 'com.android.support:design:28.0.0-rc01'
}

I am also sharing the code where the import is not working:

enter image description here

Upvotes: 2

Views: 5341

Answers (3)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

You should add

implementation 'com.android.support:recyclerview-v7:27.1.1' //28.0.0-rc01

After that, Clean-rebuild and Run.

Upvotes: 1

Sai Aditya
Sai Aditya

Reputation: 2393

Right click on app --> Open Module Settings --> Dependencies then on right side click on plus button. Add library dependency and search recyclerview and then add it.enter image description here

Upvotes: 0

user8959091
user8959091

Reputation:

Add this to your gradle:

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

and then click "Sync now".

Upvotes: 1

Related Questions