How to import RecyclerView for Android L-preview

I have created using following lines and this works for me.

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

For AndroidX

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

Figured it out.

You'll have to add the following gradle dependency :

compile 'com.android.support:recyclerview-v7:+'

another issue I had compiling was the compileSdkVersion. Apparently you'll have to compile it against android-L

Your build.gradle file should look something like this:

apply plugin: 'android'
android {
    compileSdkVersion 'android-L'
    buildToolsVersion '19.1.0'
    [...]
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:recyclerview-v7:+'
}