title: Getting Error "Gradle DSL method not found: 'compile()'" when Syncing Build.Gradle
body: <p><img src="https://i.stack.imgur.com/9iBuR.png" alt="Error after resolution"><img src="https://i.stack.imgur.com/JoIO6.png" alt="project is staymax"><img src="https://i.stack.imgur.com/CnnTz.png" alt="2 build.gradle files that i am working on ">To add V4 support libraries to android studio, i followed this document:<a href="https://developer.android.com/tools/support-library/setup.html#libs-without-res" rel="noreferrer">https://developer.android.com/tools/support-library/setup.html#libs-without-res</a> but I get an error. Here is what i did</p>
  
  <ol>
  <li>SDK manager> Installed Android Support Library and Android Repository.</li>
  <li>Go to Build.Gradle and added the line as given in the dcoument. Build.Gradle now looks like this:</li>
  </ol>
  
  <p>// Top-level build file where you can add configuration options common to all sub-projects/modules.</p>
  
  <pre><code>buildscript {
  repositories {
      jcenter()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:0.13.2'
  
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
  }
  }
  
  allprojects {
  repositories {
      jcenter()
      dependencies {
  
          compile "com.android.support:support-v4:18.0.+"
      }
  }
  
  }
  </code></pre>
  
  <p>Then, I get a popup that suggest that I sync gradle. When i sync Gradle, i get this error:</p>
  
  <p>Error:(20, 0) Gradle DSL method not found: 'compile()'
  Possible causes:<li>The project 'staymax' may be using a version of Gradle that does not contain the method.
  Open Gradle wrapper file</li><li>The build file may be missing a Gradle plugin.
  Apply Gradle plugin</li></p>
  
  <p>Am i missing any step? Please suggest. </p>
  
  <p>Build.Gradle(app)</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
  compileSdkVersion 20
  buildToolsVersion "20.0.0"
  
  defaultConfig {
      applicationId "com.appt.shreyabisht.staymax"
      minSdkVersion 15
      targetSdkVersion 20
      versionCode 1
      versionName "1.0"
  }
  buildTypes {
      release {
          runProguard false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
   }
  }
  
  dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  }
  </code></pre>