1

This is what my gradle file looks like http://codeshare.io/RWMpl , its throwing a small error saying:

gradle DSL method not found: 'compile()' .

My gradle file : 

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'org.ektorp:org.ektorp:1.4.2'
}

allprojects {
    repositories {
        jcenter()
    }
}

I followed the advice on THIS thread(see the accepted answer) , but i still get the following error:

gradle DSL method not found: 'compile()'.

Why ?

Community
  • 1
  • 1
Alexander Solonik
  • 9,838
  • 18
  • 76
  • 174

2 Answers2

3

Usually, there is a Project build.gradle and a Module build.gradle.

The screenshot that you shared was of your Module build.gradle.

This error seems to me as, you have an android block in your Project build.gradle file.

Remove android block from Project build.gradle and the app will compile fine..

Lal
  • 14,726
  • 4
  • 45
  • 70
  • the one i name currently sharing is of module , so basically you mean remove that entire android block ? why ? for what purpose is it anyway ? – Alexander Solonik Aug 07 '15 at 10:36
  • no no..i was saying, you should remove android block from your project build.gradle file, not from module build.gradle – Lal Aug 07 '15 at 10:37
2

You using a wrong gradle file. Check for build.gradle(Module:yourmodulename), this is where you have to update.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Sumighosh Charuvil
  • 446
  • 1
  • 4
  • 14