Could not find method android for arguments

时间:2025-03-25 22:20:29
Error:(23, 0) Could not find method android() for arguments [****] on root project '****' of type .

最终解决方法是,打开如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath ':gradle:2.2.2'
        classpath ':bintray-release:0.3.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module  files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete 
}
android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'
}
dependencies {
}

将其中的

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'
}

删除或注释掉后重新编译通过。
参考文章