micyunu micyunu - 1 year ago 106
Android Question

How to import RecyclerView for Android L-preview

Trying to use the new RecyclerView from the support library. I downloaded the 20 update for the support library using the SDK manager.

I've added the jar file to the libs folder - and added to build path - no luck using the RecyclerView.

Tried to use also the gradle dependency according to Android Developer's API - not sure if this is the right place to look - this page is related more to AndroidTV :


Cannot gradle sync the project.

Any ideas?

Answer Source

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:+'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download