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

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

Android Studio 在编译项目时出现此错误。我搜索了一下,发现这可能是因为

android

在我的 build.gradle 中的 build.gradle.But 上面的块可能不是问题所在。 这是我的 gradle 个文件。

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'

}

在应用 Android 插件之前,您使用的是 Gradle 领域特定语言 (DSL)。

删除

android {
compileSdkVersion 19
}

在您的顶级 build.gradle。您的应用 build.gradle 文件中已经有 compileSdkVersion 20 真正重要的地方。

now its showing "Error:(16, 0) Gradle DSL method not found: 'runProguard()'

runProguard 前段时间在 Android Gradle 插件中被重命名为 minifyEnabled。您也应该在构建脚本中重命名它。

未解决: 我正在使用 gradle-experimental 来做 NDK 的东西。

错误:(13, 0) Dexcount 插件需要配置 Android 插件 我的顶级 build.gradle 文件:

构建脚本{

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

}

所有项目{

repositories {
    jcenter()
}

}