无法解析符号 v7:导入 android.support.v7.widget.RecyclerView

Lot*_*akz 4 android gradle

我正在尝试导入这个: import android.support.v7.widget.RecyclerView;

但我明白了:“无法解析symbole v7”。

确实,当我打字时,android.support.我可以选择 v4 但不能选择 v7

这是我的 build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.bibstandardandroidstudio"
        minSdkVersion 23
        targetSdkVersion 28
        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
    }
    buildToolsVersion '28.0.3'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0-alpha03'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha03'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'org.mindrot:jbcrypt:0.4'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}
Run Code Online (Sandbox Code Playgroud)

我是 Android 新手,我正在尝试按照本教程进行操作:使用 RecyclerView 创建列表

我看到这implementation 'com.android.support:appcompat-v7:28.0.0'应该可以解决我的情况,但似乎不起作用

Iai*_*ain 7

添加以下依赖项以使用 recylerview:

implementation 'com.android.support:recyclerview-v7:28.0.0'

或对于 Android X:

implementation 'androidx.recyclerview:recyclerview:1.0.0'

如“添加支持库”下的第 2 点所指定,创建 recylerview。您可以在 androidx 下使用 recyclerview,如下所示:

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
Run Code Online (Sandbox Code Playgroud)