【发布时间】: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