45.Error:(xx, yy)Could not find method android() for arguments

Error:(22, 0) Could not find method android() for arguments

开发中,新从远程仓库或者新建项目有时会出现这个错误提示:

Error:(22, 0) Could not find method android() for arguments
[build_9wglzemmdwpqh4v6gkig07116$_run_closure3@565f363a] on root project 'MyApplicationTest' of type org.gradle.api.Project.

错误原因:

开发工具的自身的bug,在自动帮我们生成一些代码时,生成错了地方。其中这Error:(22,0),表示这是一个错误,且错误出现在22行,第0列处。点击open file,可以快速直达该出错位置。

解决方案:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

android {
    compileSdkVersion 'Google Inc.:Google APIs:17'
}
dependencies {
}

从上面找到该部分,并把上面的这部分删除即可。如下:

android {
    compileSdkVersion 'Google Inc.:Google APIs:17'
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容