【问题标题】:Could not find method complie() for arguments whilst adding recyclerView dependency添加 recyclerView 依赖项时找不到参数的方法 compile()
【发布时间】:2017-09-08 14:53:38
【问题描述】:

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

在 andriod studio 中,我去构建 > 编辑库和依赖项。然后在选择库依赖项中搜索 Recycler。我在下面找到了库。

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.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找不到参数 [com.android.support:recyclerview-v7:25.3.1] 的方法 complie()。

分级

 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>

【问题讨论】:

    标签: android android-gradle-plugin


    【解决方案1】:

    你有complie而不是compile

    【讨论】:

      【解决方案2】:

      找不到方法complie()

      你的dependencies有一个小错字

      变化:

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

      与:

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

      【讨论】:

        猜你喜欢
        • 2016-08-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-29
        • 2022-01-23
        • 2017-10-01
        相关资源
        最近更新 更多