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

Android Studio provides this error when compiling a project. I searched and discovered that this could be due to

android

The block at the top of build.gradle. But in my build.gradle this may not be the problem. here are my gradle files.

build.gradle

// 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.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } android { compileSdkVersion 19 } dependencies { 

}

app.gradle

  apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.ptrprograms.chromecast" minSdkVersion 14 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:20.0.0' compile 'com.android.support:mediarouter-v7:19.0.+' compile 'com.google.android.gms:play-services:6.1.11' 

}

+5
source share
2 answers

You are using the Gradle Domain-Specific Language (DSL) defined in the Android plugin before applying this plugin.

Remove

 android { compileSdkVersion 19 } 

in your top level build.gradle file. You already have compileSdkVersion 20 in the build.gradle file of the application, where it really matters.

now displays "Error: (16, 0) Gradle DSL method not found:" runProguard () "

runProguard was renamed minifyEnabled in the Android Gradle plugin a while ago. You should also rename it in your build script.

+10
source

Not allowed: I use gradle -experimental to create NDK material.

Error: (13, 0) The Dexcount plugin requires the configuration of the MY Android plugin. Top-level file build.gradle:

buildscript {

 repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle-experimental:0.4.0' } 

}

allprojects {

 repositories { jcenter() } 

}

+1
source

All Articles