无法在Android studio中导入项目(无法找到用于参数的compile()方法)



不好意思。我不明白为什么我不能导入项目到我的安卓工作室。我有文件build 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
}

but I have error:

错误:(9,0)无法找到用于参数的方法compile()[com.android.tools.build:gradle:2.2.2org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。开放文件

为什么是均值?

您正在使用错误的构建。gradle 文件。

你不能在顶层文件中定义android block。

只需将此部分移动到模块/build中。gradle 文件。

最新更新