Can';导入Android库
我正在尝试使用RecyclerView助手,但无法使用它进行项目工作。 以下是我正在尝试使用的库: 但是得到这个错误:Can';导入Android库,android,jcenter,Android,Jcenter,我正在尝试使用RecyclerView助手,但无法使用它进行项目工作。 以下是我正在尝试使用的库: 但是得到这个错误: Could not find method implementation() for arguments [com.android.support:appcompat-v7:{latest version}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDepend
Could not find method implementation() for arguments [com.android.support:appcompat-v7:{latest version}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Please install the Android Support Repository from the Android SDK Manager.
这是我的身材。格雷德尔:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
def supportLibVersion="{latest version}"
// Required
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
implementation "com.android.support:recyclerview-v7:${supportLibVersion}"
// RecyclerViewHelper
implementation "com.github.nisrulz:recyclerviewhelper:${supportLibVersion}"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我认为
最新版本是一个占位符文本。最新版本
应替换为所需SDK的最新版本
请用这个
def supportLibVersion="27.1.1"
而不是
def supportLibVersion="{latest version}"
您的库文档也有这一行
其中,{latest version}
对应于27.1.1
中发布的版本
这是project.gradle文件,您在错误的gradle文件中导入库。请在app.gradle文件中导入此库
在app.gradle上导入此文件
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.nisrulz:recyclerviewhelper:27.1.1'
}
在project.gradle上导入此文件
allprojects {
repositories {
google()
jcenter()
}
}