在添加recyclerview依赖性时,找不到参数的方法()



我正在尝试添加依赖项,以便我可以使用recyclerview。

在Andriod Studio中,我去构建>编辑库和依赖项。然后在选择库依赖项中搜索回收器。我在下面找到了库。

com.android.support:recyclerview-v7 (com.android.support:recyclerview-v7:26.0.0-alpha1)

添加此之后,尽管Gradle无法构建。我在这里读到,这是由于版本所致,应该更改为'com.android.support:recyclerview-v7:25.3.1'。

但是,现在我收到了我不遵循的不同错误消息,

Error:(30, 1) A problem occurred evaluating project ':app'.

在类型org.gradle.gradle.api.internal.artifacts.dsl.depertencies.defaultdependentlenderency Handler中。>

gradle

 apply plugin: 'com.android.application'
 android {
    compileSdkVersion 25
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.xxx.yyyyyyyyy"
        minSdkVersion 24
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
   }
 }
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    complie 'com.android.support:recyclerview-v7:25.3.1'
}

清单

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

您有complie而不是compile

找不到方法compeipe()

您的dependencies

中有一个小错字

更改:

complie 'com.android.support:recyclerview-v7:25.3.1'

with:

compile 'com.android.support:recyclerview-v7:25.3.1'

最新更新