Error: (20, 0) Gradle DSL method not found: 'compile ()'

I've looked at other related ones, but no one seems to solve my problem in Gradle.

Here is my Gradle build (module app)

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()
    }
   }
  }

      

This gives me "Error: (20, 0) Gradle DSL method not found: 'compile ()' Possible causes. The Project may be using a Gradle version that does not contain a method.

Open your Gradle wrapper file The build file may be missing the Gradle plugin. Apply the Gradle Plugin

What am I doing wrong?

+3


source to share


1 answer


You cannot add compilation dependencies to the global build.gradle

. Removing the second block of dependencies in your global build.gradle

file will fix the error.



+3


source







All Articles