错误:(20,0)Gradle DSL方法未找到:“compile()”

3
我看了其他相关的内容,但似乎没有解决我的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()
    }
   }
  }

它给我的是:
"错误:(20,0)Gradle DSL方法未找到:'compile()' 可能的原因:项目“Project”可能正在使用不包含该方法的Gradle版本。 打开Gradle包装文件 构建文件可能缺少Gradle插件。 应用Gradle插件"
我做错了什么?
1个回答

3
您不能在全局的build.gradle文件中添加编译依赖项。移除global build.gradle文件中的第二个依赖块即可解决该错误。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接