无法解析导入android.support.v7.widget.RecyclerView;
我需要在Android Studio中创建一个recyclerview。我不知道为什么它一直说它无法解决symbol recyclerview。我已经根据那些网站教程完成了所有步骤 我的应用程序渐变文件:无法解析导入android.support.v7.widget.RecyclerView;,android,android-studio,android-recyclerview,Android,Android Studio,Android Recyclerview,我需要在Android Studio中创建一个recyclerview。我不知道为什么它一直说它无法解决symbol recyclerview。我已经根据那些网站教程完成了所有步骤 我的应用程序渐变文件: apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 29 buildToolsVersion "2
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:appcompat-v7:29.1.1'
//card view
implementation 'com.android.support:cardview-v7:29.1.1'
//recyclerView
implementation 'com.android.support:recyclerview-v7:29.1.1'
//picasso library to retrive images
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.firebase:firebase-storage:18.0.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-database:18.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
apply plugin: 'com.google.gms.google-services'
}
apply插件:“com.android.application”
应用插件:“com.google.gms.googleservices”
安卓{
编译DK29版
buildToolsVersion“29.0.0”
默认配置{
applicationId“com.example.myapplication”
第17版
targetSdkVersion 29
版本代码1
版本名称“1.0”
多索引启用真
TestInstrumentRunner“androidx.test.runner.AndroidJUnitRunner”
}
gradle.项目评估{
tasks.withType(JavaCompile){
options.compilerArgs您试图访问错误的包
尝试androidx.recyclerview,而不是传统的android.support.v7.widget.recyclerview
您应该替换所有com.android.support.*依赖项,并替换为androidx等效项。(目前,您混合使用了androidx和旧版android.support依赖项)
您可以尝试在Android Studio上使用重构>迁移到AndroidX选项进行自动修复
将您的recyclerview库替换为此->androidx.recyclerview:recyclerview:1.0.0
当您使用androidx时,但是您的recycler视图的库仍然是支持库格式的
要获得正确的迁移信息,请参阅此->发布日志,而不是截图。您有一半jetpack和一半appcompat。