我刚刚在我的计算机上安装了Android Studio 3.3和Java,当我立即打开一个新项目时出现了这个错误。
ERROR: Gradle DSL method not found: 'testImplementation()'
Possible causes:
The project 'My Application' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.4.0 and sync project
The project 'My Application' may be using a version of Gradle that does not contain the method.
Gradle settings
The build file may be missing a Gradle plugin.
Apply Gradle plugin
当我尝试手动更新时,我下载了gradle 5.4.0并手动安装。 (我还检查了cmd以查看其版本。)
然后我改变了
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
这些代码用于gradle:5.4.0我仍然有同样的错误。我该如何修理它?
}
dependencies {
classpath 'com.android.tools.build:gradle:5.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {repositories {google()jcenter()// maven {url“https://jitpack.io”}}}
task clean(类型:删除){delete rootProject.buildDir}如果您是土耳其工作站,请更改build.gradle:
testImplementation
- > testİmplementation
androidTestImplementation
- > androidTestİmplementation
androidTestImplementation
- > androidTestİmplementation