嗨,我的构建 gradle 出现以下错误 Could not find method implemnetation() for arguments.
我试图清理 gradle cache clean 项目,但没有任何效果。我看过类似的帖子,但我找不到答案。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'java-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
implementation 'org.hibernate:hibernate-core:3.6.7.Final'
api 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.+'
implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.6.+@aar'
}
}
allprojects {
repositories {
jcenter()
}
}
最佳答案
您的项目和应用程序模块都有 build.gradle
文件。
在这里,您正在混合顶级build.gradle
,应该是这样的:
项目 build.gradle
(项目文件夹内的顶层)
//the `java-library` plugin is unnecessary here
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
//the gradle plugin version is the same as Android Studio, here v3.1.1 which is currently the latest stable
classpath 'com.android.tools.build:gradle:3.1.1'
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}
应用模块
build.gradle
(应用模块文件夹内的模块级别)apply plugin: 'com.android.application'
android{...}
dependencies {
implementation 'org.hibernate:hibernate-core:3.6.7.Final'
api 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.+'
implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.6.+@aar'
}
有关这 2 个
build.gradle
的更多信息文件,您可以引用 top level 的文档和 module level
关于android - 找不到参数的方法 implementation()。错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49884398/