g71132 g71132 - 1 year ago 228
Java Question

Cant import project in Android studio(Could not find method compile() for arguments)

Sorry for my english. I cant understand why i cant import project to my android studio. I have file build gradle

buildscript {
repositories {

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"

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

but i have error:

Error:(9, 0) Could not find method compile() for arguments
[com.android.tools.build:gradle:2.2.2] on object of type

why its mean?

Answer Source

You are using the wrong build.gradle file.

In your top-level file you can't define an android block.

Just move this part inside the module/build.gradle file.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download