2016-11-10 78 views
0

对不起,我的英语。我不明白为什么我不能导入项目到我的android工作室。我有文件构建gradle这个无法在Android工作室导入项目(无法找到方法编译()参数)

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 
} 

,但我有错误:

Error:(9, 0) Could not find method compile() for arguments [com.android.tools.build:gradle:2.2.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Open File

为什么它是什么意思?

回答

0

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

在您的顶层文件中,您无法定义android块。

只需推动模块/的build.gradle文件中这一部分。

+0

你是对的,谢谢!问题出在一个图书馆 – g71132

相关问题