繁体   English   中英

无法为org.gradle.api.Project类型的根项目“MyApplication3”获取未知属性“删除”

[英]Could not get unknown property 'Delete' for root project 'MyApplication3' of type org.gradle.api.Project

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
}

最后三行是问题所在。 它默认添加。

怎么解决这个?

试着通过这段代码:在app Laval app.gradle中,而不是在顶层。

task clean(type: Delete) {
    delete rootProject.buildDir
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM