Android studio 3.1.2 - >新项目 - >构建失败,并在日志中出现以下问题:
Could not get unknown property 'Delete' for root project 'MyApplication3' of type org.gradle.api.Project.
Open File
这是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.1.2'
// 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
}
最后三行是问题所在。它默认添加。
如何解决这个问题?
答案 0 :(得分:0)
尝试通过此代码:在app Laval app.gradle中,而不是在顶层。
task clean(type: Delete) {
delete rootProject.buildDir
}