Android 缺少 RecyclerView
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24441107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RecyclerView is missing
提问by Eli Revah
I just installed the new SDK tools (Android L Developer Preview), and I'm trying to use RecyclerView
but it seems to be missing.
我刚刚安装了新的 SDK 工具(Android L 开发者预览版),我正在尝试使用,RecyclerView
但似乎缺少它。
From my understanding I should include the v7
support library, but I can't seem to do that...
根据我的理解,我应该包含v7
支持库,但我似乎无法做到这一点......
I can't seem to find the v7 library in the SDK folder (I did install the Android Support Library from the SDK Manager).
我似乎无法在 SDK 文件夹中找到 v7 库(我确实从 SDK 管理器安装了 Android 支持库)。
回答by Gabriele Mariotti
You have to update the android repository, the support library and you have to use this dependency:
您必须更新 android 存储库、支持库,并且必须使用此依赖项:
compile 'com.android.support:recyclerview-v7:+'
UPDATED 30/10/2017:
2017 年 10 月 30 日更新:
Using the +
is not a good option because you are not able to replicate the build in the future.
使用+
不是一个好的选择,因为您将来无法复制构建。
You can use one of these versions. Check your sdk for updated version:
您可以使用这些版本之一。检查您的 sdk 以获取更新版本:
//it requires compileSdkVersion 27
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.1'
compile 'com.android.support:recyclerview-v7:27.0.0'
//it requires compileSdkVersion 26
//it requires to add the google maven repo
// maven {
// url "https://maven.google.com"
// }
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.0.2'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.0'
//it requires compileSdkVersion 25
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
//it requires compileSdkVersion 24
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.0'
//it requires compileSdkVersion 23
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
//it requires compileSdkVersion 22
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
//it requires compileSdkVersion 21
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.0'
回答by Spotlight
The only way I found to use that library is by copying The .aar file that you can find in /extras/android/m2repository/com/android/support/recyclerview-v7/21.0.0-rc/ Than rename it in .zip and uncompress-it. Than copy the class.jar file in you project library (maybe rename it in something more like recyclerview-v7.jar).
我发现使用该库的唯一方法是复制您可以在 /extras/android/m2repository/com/android/support/recyclerview-v7/21.0.0-rc/ 中找到的 .aar 文件,然后将其重命名为 .zip并解压缩它。比复制项目库中的 class.jar 文件(也许将其重命名为更像 recyclerview-v7.jar)。
Please remember to upgrade The jar when new versions will be rolled out
请记得在新版本推出时升级 jar
回答by Waqas Ahmed
you have to give the full path in gradle build dependency
您必须在 gradle 构建依赖项中提供完整路径
like
喜欢
compile 'com.android.support:recyclerview-v7:23.0.0'
编译'com.android.support:recyclerview-v7:23.0.0'
as it will give error due to looking in a directory named 23.0 so provide full path
因为在名为 23.0 的目录中查找会出错,因此请提供完整路径
回答by beginner
Steps to achieve:
实现步骤:
1.Select the latest Android SDK Tools, Platform-tools, and Build-tools. Select latest Android Support Library & Android Support Repository.
1.选择最新的Android SDK Tools、Platform-tools和Build-tools。选择最新的 Android 支持库和 Android 支持库。
2.After updating Android Support Repository from SDK Manager go to..\sdk\extras\android\m2repository\com\android\support\recyclerview-v7\21.0.0-rc1
2.从SDK Manager更新Android Support Repository后去..\sdk\extras\android\m2repository\com\android\support\recyclerview-v7\21.0.0-rc1
3.Unzip recyclerview-v7-21.0.0-rc1.aar
3.解压recyclerview-v7-21.0.0-rc1.aar
4.After unzipping recyclerview-v7-21.0.0-rc1.aar you will get classes.jar
4.解压recyclerview-v7-21.0.0-rc1.aar后得到classes.jar
5.rename classes.jar to recyclerView.jar for feature reference and add to your Android app under /lib folder
5.将 classes.jar 重命名为 recyclerView.jar 以供功能参考并添加到 /lib 文件夹下的 Android 应用程序中
回答by Keshav Gera
compile 'com.android.support:appcompat-v7:25.3.1'
编译'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
回答by Bmedeir1
For me, I was able to fix it by updating to the most recent version of android studio (3.3). I ran into some issues after updating which I resolved by using the "Import Project option" instead of just re-opening the project.
对我来说,我能够通过更新到最新版本的 android studio (3.3) 来修复它。更新后我遇到了一些问题,我使用“导入项目选项”解决了这些问题,而不仅仅是重新打开项目。
回答by Makarand
Those who are looking for androidX
dependency:
那些正在寻找androidX
依赖的人:
implementation 'androidx.recyclerview:recyclerview:1.0.0'