title: Gradle Error in Android Studio: Plugin with id 'com.android.library' not found
body: <p>When I am trying to Build an Android Library Project in Android Studio, I am getting the following Gradle error:</p>
  
  <pre><code>Gradle sync failed: Plugin with id 'com.android.library' not found.
  </code></pre>
  
  <p>I am pretty new to Gradle and this is very confusing for me. Why is this happening?</p>
  
  <p>The build.gradle file is as follows:</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.2"
  
      defaultConfig {
          minSdkVersion 8
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.1.0'
  }
  </code></pre>