Alexander Solonik
Alexander Solonik

Reputation: 10230

gradle DSL method not found: 'compile()' persisting error

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 ?

Upvotes: 1

Views: 1025

Answers (2)

Sumighosh Charuvil
Sumighosh Charuvil

Reputation: 446

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

Upvotes: 2

Lal
Lal

Reputation: 14810

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..

Upvotes: 3

Related Questions