Wernon
Wernon

Reputation: 228

Android Studio. Error:(19,0)

Got the problem after updating Android Studio, SDK and tools:

Error:(19, 0) Gradle DSL method not found: 'android()'

Please help to fix it:

Top build.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.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}

android {
    compileSdkVersion 16
   // buildToolsVersion '22.0.1' //23.02.2
}
dependencies {
}

The other one build.gradle (Module:app)file:

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 16
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.mateuyabar.android.pillownfc"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.0'
}

Here is the Error Messages Gradle Sync:

Error:(19, 0) Gradle DSL method not found: 'android()'

Possible causes:

The project 'pillowNFC-master' may be using a version of Gradle that does not contain the method. -Open Gradle wrapper file

The build file may be missing a Gradle plugin. -Apply Gradle plugin

Event Log:

11:20:46 Gradle sync started

11:20:48 Gradle sync failed: Gradle DSL method not found: 'android()' Consult IDE log for more details (Help | Show Log)

I know, this problem was asked before, but I didn't find solution in anothe discussions =(

It would be nice if somebody can help, I'm quite new in programming.

Upvotes: 0

Views: 914

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363439

You are using the wrong build.gradle file

In your top-level file you can't use the android block.
Check also this post.

Just remove this part from the first build.gradle

android {
    compileSdkVersion 16
   // buildToolsVersion '22.0.1' //23.02.2
}
dependencies {
}

Also pay attention.
Since you are using the appcompat v23, you have to compile with API 23.

In your module/build.gradle change the compileSdkVersion to 23

 compileSdkVersion 23

Upvotes: 1

Related Questions