无法导入 Android 库
Can't import Android library
我正在尝试使用 RecyclerView Helper,但无法使用它进行项目工作。
这是我尝试使用的库:https://github.com/nisrulz/recyclerviewhelper
但是出现这个错误:
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.
这是我的 build.gradle:
// 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
}
我认为 latest version
是一个占位符文本。 latest version
应替换为您需要的最新版本的 SDK。
请使用这个
def supportLibVersion="27.1.1"
而不是
def supportLibVersion="{latest version}"
你的库文档也有这一行
where {latest version}
corresponds to published version in 27.1.1
.
这是 project.gradle 文件,你导入库错误 gradle file.please 在 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()
}
}
我正在尝试使用 RecyclerView Helper,但无法使用它进行项目工作。 这是我尝试使用的库:https://github.com/nisrulz/recyclerviewhelper
但是出现这个错误:
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.
这是我的 build.gradle:
// 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
}
我认为 latest version
是一个占位符文本。 latest version
应替换为您需要的最新版本的 SDK。
请使用这个
def supportLibVersion="27.1.1"
而不是
def supportLibVersion="{latest version}"
你的库文档也有这一行
where
{latest version}
corresponds to published version in27.1.1
.
这是 project.gradle 文件,你导入库错误 gradle file.please 在 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()
}
}