Gradle项目同步失败android studio版本2.2.3错误

时间:2017-06-27 00:53:00

标签: android

这是我第一次使用android studio并且我不断收到一条错误消息:

  

Gradle sync失败:在类型为org.gradle.api.Project的根项目“MyApplication”上找不到参数[build_43qncadg6ssgwl9025usbfvce $ _run_closure3 @ c74f8ce]的方法android()。                   有关详细信息,请参阅IDE日志   这是代码:   //顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项。

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 25
    buildToolsVersion '25.0.3'

}

dependencies {

}
  

错误:无法为参数找到方法android()。

这个错误是什么意思?我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

典型的Android项目有一个根项目和一个包含该应用程序的子项目。您似乎展示了根项目的build.gradle

android部分通常会进入子项目build.gradle