【发布时间】:2015-08-23 15:33:19
【问题描述】:
错误:(1, 0) Gradle DSL 方法未找到:'android()'
可能的原因:
根/build.gradle
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
applicationId "com.example.shark.gpsapp"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
}
App/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "com.example.shark.myapp"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
我无法打开我的任何旧项目。请提出一个答案。 android studio 更新后出现此错误。
【问题讨论】:
-
请发布您的
build.gradle文件。在一个典型的 Android Studio 项目中,会有两个,一个在项目根目录中,一个在项目根目录下的app/模块目录中。
标签: android android-studio android-gradle-plugin