Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';导入Android库_Android_Jcenter - Fatal编程技术网

Can';导入Android库

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

我正在尝试使用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.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()
  }
}