How to import RecyclerView for Android L-preview

前端 未结 22 1546
被撕碎了的回忆
被撕碎了的回忆 2020-12-02 14:55

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 th

相关标签:
22条回答
  • 2020-12-02 15:53

    If you using the updated or 2018 Version for Android Studio...

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

    will give you an error with following message "Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018."

    Try using this

    implementation 'com.android.support:recyclerview-v7:+'
    
    0 讨论(0)
  • 2020-12-02 15:55

    The steps before me are just missing one step.

    After altering the build.gradle (Module:app) and adding the following dependencies:

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

    (Add cardview if necessary)

    You must then must go to Build > Clean Project to get rid of any errors

    0 讨论(0)
  • 2020-12-02 15:55

    in my case I fixed it by putting compile 'com.android.support:recyclerview-v7:22.0.0' as a dependency into my gradle build

    (with Android studio v. 1.2.1.1 and all sdk's updated.)

    It's really annoying when codes are updated so fast and the IDE can't keep track of them, and you have to manually fix for them, wasting time and resources.

    But well, at last it works.

    0 讨论(0)
  • 2020-12-02 15:55

    include the dependency in the build.gradle, and sync the project with gradle files

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:25.1.0'
    
        //include the revision no, i.e 25.1.1
        implementation 'com.android.support:recyclerview-v7:25.1.1'
    }
    

    Include the revision(here its 25.1.1) to avoid unpredictable builds, check library revisions

    0 讨论(0)
提交回复
热议问题