title: Unsupported Gradle DSL method found: 'compile()'!
body: <p>I'm going through Google's documentation on "Add Google Play Services to Your Project" in Android Studio:
  <a href="https://developer.android.com/google/play-services/setup.html">https://developer.android.com/google/play-services/setup.html</a></p>
  
  <p>I'm using that documentation to modify the build.gradle file of a freshly created Android project.  In Step 2 (Add Google Play Services to Your Project), it states:</p>
  
  <p>Add this line:</p>
  
  <pre><code>apply plugin: 'android'
  </code></pre>
  
  <p>Under Dependencies, add this:</p>
  
  <pre><code>compile 'com.google.android.gms:play-services:5.0.77'
  </code></pre>
  
  <p>It also says to update that version after updating Google Play Services, which is now at 18 according to Android SDK Manager.</p>
  
  <p>Here is my entire build.gradle file at the top-level (parent of this file is the root folder).</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  apply plugin: 'android'
  
  buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.12.+'
          compile 'com.google.android.gms:play-services:18'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  </code></pre>
  
  <p>Upon saving, it prompts for a Sync.  I Sync it, but get:</p>
  
  <pre><code>Build script error, unsupported Gradle DSL method found: 'compile()'!
  
  Error:(10, 0) Possible causes could be:
                - you are using a Gradle version where the method is absent
                - you didn't apply Gradle plugin which provides the method
                - or there is a mistake in a build script
  </code></pre>
  
  <p>I'm using Android Studio 0.8.2.  I didn't install Gradle, just using the plugin that came with Android Studio.</p>
  
  <p>It's interesting to note that the build.gradle file generated when I made this new project says:</p>
  
  <pre><code>//NOTE: Do not place your application dependencies here
  </code></pre>
  
  <p>But Google's documentation says (which conflicts with the above):</p>
  
  <pre><code>Note: Android Studio projects contain a top-level build.gradle file and a build.gradle
        file for each module. Be sure to edit the file for your application module.
  </code></pre>
  
  <p>What's wrong with my build.gradle file (or environment)?</p>