title: Could not get unknown property 'supportLibraryVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
body: <p>I added an external library to my android project. After gradle sync I got the following error:</p>
  
  <p>ERROR: Could not get unknown property 'supportLibraryVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.</p>
  
  <p>This is the build.gradle file of the library I added:</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 26
      buildToolsVersion "28.0.3"
  
      defaultConfig {
          minSdkVersion 16
          targetSdkVersion 26
          testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      sourceSets {
          main.java.srcDirs += 'src/main/base'
          main.java.srcDirs += 'src/main/api9'
          main.java.srcDirs += 'src/main/api14'
          main.java.srcDirs += 'src/main/api21'
          main.java.srcDirs += 'src/main/api23'
      }
  }
  
  dependencies {
      implementation "com.android.support:support-annotations:$supportLibraryVersion"
      implementation "com.android.support:support-v4:$supportLibraryVersion"
  
      // Tests
      testCompile 'junit:junit:4.12'
      androidTestCompile('com.android.support.test:runner:0.5') {
          exclude module: 'support-annotations'
      }
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
          exclude module: 'support-annotations'
      }
  }
  </code></pre>
  
  <p>The supportLibraryVersion was declared in my app gradle file as follows:</p>
  
  <pre><code>ext {
      supportLibraryVersion = '27.1.0'
  }
  </code></pre>
  
  <p>I tried to manually declare the supportLibraryVersion in the gradle file.</p>
  
  <pre><code>implementation "com.android.support:support-annotations: '27.1.0'"
  implementation "com.android.support:support-v4:'27.1.0'"
  </code></pre>
  
  <p>Then the following error occurs:</p>
  
  <pre><code>ERROR: Failed to resolve: com.android
  Affected Modules: library
  </code></pre>