Gradle DSL method not found: 'testimplementation()'
项目“我的项目”可能使用不包含该方法的 Gradle 版本。 构建文件可能缺少 Gradle 插件。 应用gradle插件
我已经尝试过
- 删除重新同步的项目 .gradle
- 使/缓存无效并重新启动使用
- 本地 gradle 分发选项
Gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.techknocorp.a.metturcable"
minSdkVersion 14
targetSdkVersion 26
versionCode 532016
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testimplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
androidTestImplementation 'com.android.support.test:runner:1.1.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.1.1'
implementation files('libs/opencsv-2.3.jar')
}
顶级 Gradle //顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
最佳答案
使用testImplementation
而不是testimplementation
。
dependencies {
//....
testImplementation 'junit:junit:4.12'
//..
}
关于android - 未找到 Gradle DSL 方法 : 'testimplementation()' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56255819/