Android 错误:(20,0)未找到Gradle DSL方法:';编译()';

Android 错误:(20,0)未找到Gradle DSL方法:';编译()';,android,android-studio,gradle,Android,Android Studio,Gradle,我看了其他相关的,但似乎没有解决我在格拉德尔的问题 这是我的构建梯度(模块应用程序) 它给我的是什么 错误:(20,0)找不到Gradle DSL方法:“compile()” 可能原因:项目“project”可能使用的Gradle版本不包含该方法 打开Gradle包装文件 生成文件可能缺少Gradle插件。请应用Gradle插件“ 我做错了什么 不能将编译依赖项添加到全局build.gradle文件中。删除全局build.gradle文件中的第二个依赖项块将修复错误 apply plugin:

我看了其他相关的,但似乎没有解决我在格拉德尔的问题

这是我的构建梯度(模块应用程序)

它给我的是什么 错误:(20,0)找不到Gradle DSL方法:“compile()” 可能原因:项目“project”可能使用的Gradle版本不包含该方法

打开Gradle包装文件 生成文件可能缺少Gradle插件。请应用Gradle插件“


我做错了什么

不能将编译依赖项添加到全局
build.gradle
文件中。删除全局
build.gradle
文件中的第二个依赖项块将修复错误

apply plugin: 'com.android.application'

 android {
 compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.example.abdul_000.project"
    minSdkVersion 9
    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 files('libs/android-support-v13.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
}



// 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'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

    }
    dependencies {




        compile 'com.android.support:support-v4:19.0.0'
        compile fileTree(dir: 'libs', include: ['*.jar'])



    } apply plugin: 'application'
    allprojects {
    repositories {
        jcenter()
    }
   }
  }