我使用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.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()
}
}
答案 0 :(得分:1)
从顶级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