错误:(1,0)未找到Gradle DSL方法:“ android()” [英] Error:(1, 0) Gradle DSL method not found: 'android()'
问题描述
我该怎么做才能解决此问题?
我在android studio0.9.1中运行项目时遇到此错误
What should i do to fix this issue? I am getting this error when i ever i run my project in android studio0.9.1
android {compileSdkVersion 17
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.nearby"
minSdkVersion 11
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}}dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:19.0.0'
compile files('libs/google-play-services.jar')}
推荐答案
我只是遇到了同样的错误。确保项目的顶级build.gradle中没有 android
块,仅在模块的build.gradle文件中没有。
I just ran into this same error. Make sure you don't have an android
block in the top-level build.gradle for the project, only in the module's build.gradle file.
当AndroidStudio尝试导入和存在可构建的Eclipse / ADT项目时,这发生在我身上–我不得不从中剪切并粘贴 android
块一个gradle文件传给另一个。我不知道此问题是否已在最新版本的AndroidStudio中得到解决。
This happened to me when AndroidStudio tried to import and existing, buildable Eclipse/ADT project–I had to cut and paste the android
block from one gradle file to the other. I don't know if this has been fixed in more recent versions of AndroidStudio.
这篇关于错误:(1,0)未找到Gradle DSL方法:“ android()”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!