Android StudioGradle

Gradle DSL method not found – Android Studio

After importing Eclipse project to Android Studio. When you run the project, you may see following error message as, Gradle DSL not found: ‘android()’

Gradle DSL

Solution to fix this Gradle DSL method issue

open Top-level build.gradle file of the project

as_gbuild_file

And remove the following code lines.

android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
}

And then click Sync menu button, fixes the issue.

sync

And another possible issue is,

Gradle DSL method not found: ‘runProguard()’

At times when you import a downloaded sample project in to Android Studio, see following error message as, Gradle DSL not found: ‘runProguard()’

app_gradlefile-2

Solution to fix this

open app’s build.gradle file of the project

app_gradlefile

In this file you can see following code snippet

buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

In the above code runProguard false causing the issue. Change that line to

minifyEnabled false

Now click Sync menu button, issue will be fixed. I see the reason for this is runProguard has been renamed to minifyEnabled in version 0.14.0 or more in Gradle.

Hope it helps somebody. 😎

You may be also interested in

One thought on “Gradle DSL method not found – Android Studio

Leave a Reply

Your email address will not be published. Required fields are marked *