错误:(19,0)未找到Gradle DSL方法:'android()'

san*_*n88 5 android build.gradle

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

安卓

阻止在我的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 {
Run Code Online (Sandbox Code Playgroud)

}

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'
Run Code Online (Sandbox Code Playgroud)

}

laa*_*lto 10

您在应用该插件之前使用Android插件中定义的Gradle域特定语言(DSL).

除掉

android {
compileSdkVersion 19
}
Run Code Online (Sandbox Code Playgroud)

在您的顶级build.gradle中.您已经compileSdkVersion 20在应用程序build.gradle文件中有实际问题.

现在显示"错误:(16,0)Gradle DSL方法未找到:'runProguard()'

runProguardminifyEnabled不久前在Android Gradle插件中重命名为.您也应该在构建脚本中重命名它.