无法在Android工作室中导入项目(找不到参数的方法compile())

时间:2016-11-10 09:42:40

标签: java android android-studio

抱歉我的英文。我不明白为什么我不能将项目导入我的android工作室。我有文件构建gradle

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        compile 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:1.5.0-beta2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            url "https://jitpack.io"
        }
        jcenter()
    }
}

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

但我有错误:

  

错误:(9,0)找不到参数的方法compile()   关于类型对象的[com.android.tools.build:gradle:2.2.2]   org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。   打开   文件

为什么意思?

1 个答案:

答案 0 :(得分:0)

您使用了错误的 build.gradle 文件。

在您的顶级文件中,您无法定义Android块。

只需将此部分移到 module / build.gradle 文件中即可。

相关问题