Android 找不到Gradle DSL方法:compile()
我使用IDE android studio 1.0.2版本 我得到以下错误:Android 找不到Gradle DSL方法:compile(),android,Android,我使用IDE android studio 1.0.2版本 我得到以下错误: Gradle DSL method not found: 'compile()' Error(0,9): The project 'MiarrayAdapter' may be using a version of Gradle that does not contain the method the built file may be missing a Gradle plugin 我的文件build.gra
Gradle DSL method not found: 'compile()'
Error(0,9): The project 'MiarrayAdapter' may be using a version
of Gradle that does not contain the method
the built file may be missing a Gradle plugin
我的文件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.0.0'
compile 'com.android.support:appcompat-v7:+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
我有其他文件build.gradle(模块应用程序),代码是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.cursoandroid.miarrayadapter"
minSdkVersion 6
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:+'
}
allprojects {
repositories {
jcenter()
}
}
从顶级
build.gradle中删除以下内容:
compile 'com.android.support:appcompat-v7:+'
请注意下面的评论:
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files