错误:(19,0)摇篮DSL方法未找到:'机器人() [英] Error:(19, 0) Gradle DSL method not found: 'android()'
问题描述
Android的工作室是在编译项目给这个错误。我已搜查,发现这可能是因为发生
Android Studio is giving this error while compiling the project. I have searched and found that this may happen because of
机器人
块在我的build.gradle的build.gradle.But的顶部可能是没问题的。
这里是我的文件的gradle
Block in top of the build.gradle.But in my build.gradle it may be not the problem. here is my gradle files.
的build.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
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插件定义摇篮领域特定语言(DSL)。
You're using Gradle domain-specific language (DSL) defined in the Android plugin before applying that plugin.
删除
android {
compileSdkVersion 19
}
在顶层的build.gradle。你已经有了 compileSdkVersion 20
在它实际上就您的应用程序的build.gradle文件。
in your top-level build.gradle. You already have compileSdkVersion 20
in your app build.gradle file where it actually matters.
现在它显示错误:(16,0)摇篮DSL方法未找到:'runProguard()
now its showing "Error:(16, 0) Gradle DSL method not found: 'runProguard()'
runProguard
更名为 minifyEnabled
在Android插件摇篮前一段时间。你应该在你构建脚本将其重命名为好。
runProguard
was renamed to minifyEnabled
in the Android Gradle plugin some time ago. You should rename it in your build script as well.
这篇关于错误:(19,0)摇篮DSL方法未找到:'机器人()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!