简体   繁体   中英

Can't use RecyclerView in my Android library project

I have an Android library project and want to include a class that extends RecyclerView.Adapter . My build.gradle file includes the following:

apply plugin: 'com.android.library'

dependencies {
    compile 'com.android.support:recyclerview-v7:21.0.+'
}

Despite this, I cannot import RecyclerView in any java file; it even does not show up in the code completions popup in Android Studio (Control+Space). What's wrong?

重建项目并清理它

I faced the exact same problem. Unfortunately your accepted answer did not worked for me. what i did was---- went to my library gradle file( build.gradle(Modules:youLibraryname) ) and added the class path for RecyclerView. Something like this,

dependencies{ 

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'

}

Hope this helps to someone! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM