简体   繁体   English

未解决的参考:recyclerView

[英]Unresolved reference : recyclerView

I'm following this tutorial RecyclerView in Android Studio Tutorial and facing the Unresolved reference: recyclerview error.我正在关注Android Studio 教程中的本教程 RecyclerView并面临未解决的参考:recyclerview错误。 I think there is some problem in gradle file but I'm not able to fig it out.please help.我认为 gradle 文件中存在一些问题,但我无法解决。请帮忙。 complete gradle file as well as link to xml code is given below xml code完整的 gradle 文件以及指向 xml 代码的链接如下xml 代码

 plugins { id 'com.android.application' id 'kotlin-android' } android { compileSdk 30 defaultConfig { applicationId "com.example.newsapp" minSdk 21 targetSdk 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } } dependencies { implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.0' implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.2' implementation 'androidx.recyclerview:recyclerview:1.2.1' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' }

The tutorial is outdated.该教程已过时。 It uses synthetics, which is deprecated and can't be used anymore.它使用合成材料,已弃用且不能再使用。 Read here more about migrating from synthetics, or try to find a more recent tutorial:在此处阅读有关从合成迁移的更多信息,或尝试查找更新的教程:

Migrate from Kotlin synthetics to Jetpack view binding 从 Kotlin 合成材料迁移到 Jetpack 视图绑定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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