[英]Cannot import import android.support.v7.widget.RecyclerView;
While learning about RecyclerView, I am facing some problem. 在学习RecyclerView时,我遇到了一些问题。 GreenAdapter Class failed to import “android.support.v7.widget.RecyclerView”. GreenAdapter类无法导入“ android.support.v7.widget.RecyclerView”。 I am using Android Studio 3.1.4. 我正在使用Android Studio 3.1.4。 My compile SDK Version is 28. Here's my build.gradle File: 我的编译SDK版本是28。这是我的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.sunshine.sunshine.app"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':sunshinemodule')
implementation project(':base')
implementation 'com.android.support:design:28.0.0-rc01'
}
I am also sharing the code where the import is not working: 我还在共享导入无效的地方共享代码:
You should add 您应该添加
implementation 'com.android.support:recyclerview-v7:27.1.1' //28.0.0-rc01
After that, Clean-rebuild
and Run
. 之后, Clean-rebuild
并Run
。
Add this to your gradle: 将此添加到您的gradle:
implementation 'com.android.support:recyclerview-v7:28.0.0-rc01'
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
and then click "Sync now". 然后单击“立即同步”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.