Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 找不到Gradle DSL方法:compile()_Android - Fatal编程技术网

Android 找不到Gradle DSL方法:compile()

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

我使用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()
        }
    }

从顶级
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