title: Gradle: More than one variant of project :myLib matches the consumer attributes
body: <p>A library that I wrote <code>myLib</code> uses <code>RemoteMessage</code> from <code>Firebase</code>, the app itself also uses <code>Firebase</code>.</p>
  <p>Using gradle 4.7. Also facing this in 4.4.1.</p>
  <p>How to fix it?</p>
  <p>project.gradle</p>
  <pre><code>buildscript {
      
      repositories {
          google()
          jcenter()
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.1.2'
          classpath 'com.google.gms:google-services:3.3.0'
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
          mavenCentral()
          mavenLocal()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  <p>app.gradle</p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 27
      defaultConfig {
          applicationId &quot;com.test.app&quot;
          minSdkVersion 19
          targetSdkVersion 27
          versionCode 1
          versionName &quot;1.0&quot;
          testInstrumentationRunner &quot;android.support.test.runner.AndroidJUnitRunner&quot;
          multiDexEnabled true
      }
  
      dexOptions {
          preDexLibraries = false
          jumboMode = false
          javaMaxHeapSize &quot;2048M&quot;
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      productFlavors {
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
  
      implementation 'com.android.support:appcompat-v7:27.1.1'
  
      implementation 'com.google.android.gms:play-services-gcm:12.0.1'
      implementation 'com.google.android.gms:play-services:12.0.1'
      implementation 'com.google.firebase:firebase-core:12.0.1'
      implementation 'com.google.firebase:firebase-messaging:12.0.1'
      implementation 'com.google.firebase:firebase-crash:12.0.1'
  
      implementation project(&quot;:myLib&quot;)
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  <p>myLib.gradle</p>
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 27
  
  
  
      defaultConfig {
          minSdkVersion 19
          targetSdkVersion 27
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;android.support.test.runner.AndroidJUnitRunner&quot;
  
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
  
      implementation 'com.android.support:appcompat-v7:27.1.1'
  
      implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
      implementation 'com.j256.ormlite:ormlite-core:5.0'
      implementation 'com.j256.ormlite:ormlite-android:5.0'
  
      implementation 'com.google.firebase:firebase-messaging:12.0.1'
  }
  </code></pre>
  <p>Error output from <code>testApp\myLib&gt; gradle clean assembleDebug</code> and <code>testApp\app&gt; gradle clean assembleDebug</code></p>
  <blockquote>
  <p>More than one variant of project :myLib matches the
  consumer attributes:</p>
  <ul>
  <li>Configuration ':myLib:debugApiElements' variant android-aidl:
  <ul>
  <li>Found artifactType 'android-aidl' but wasn't required.</li>
  <li>Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.</li>
  <li>Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.</li>
  <li>Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
  found compatible value 'Aar'.</li>
  <li>Required org.gradle.usage 'java-api' and found compatible value 'java-api'.</li>
  </ul>
  </li>
  <li>Configuration ':myLib:debugApiElements' variant android-classes:
  <ul>
  <li>Found artifactType 'android-classes' but wasn't required.</li>
  <li>Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.</li>
  <li>Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.</li>
  <li>Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
  found compatible value 'Aar'.</li>
  <li>Required org.gradle.usage 'java-api' and found compatible value 'java-api'.</li>
  </ul>
  </li>
  <li>Configuration ':myLib:debugApiElements' variant android-manifest:
  <ul>
  <li>Found artifactType 'android-manifest' but wasn't required.</li>
  <li>Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.</li>
  <li>Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.</li>
  <li>Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
  found compatible value 'Aar'.</li>
  <li>Required org.gradle.usage 'java-api' and found compatible value 'java-api'.</li>
  </ul>
  </li>
  <li>Configuration ':myLib:debugApiElements' variant android-renderscript:
  <ul>
  <li>Found artifactType 'android-renderscript' but wasn't required.</li>
  <li>Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.</li>
  <li>Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.</li>
  <li>Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
  found compatible value 'Aar'.</li>
  <li>Required org.gradle.usage 'java-api' and found compatible value 'java-api'.</li>
  </ul>
  </li>
  <li>Configuration ':myLib:debugApiElements' variant jar:
  <ul>
  <li>Found artifactType 'jar' but wasn't required.</li>
  <li>Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.</li>
  <li>Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.</li>
  <li>Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
  found compatible value 'Aar'.</li>
  <li>Required org.gradle.usage 'java-api' and found compatible value 'java-api'.</li>
  </ul>
  </li>
  </ul>
  </blockquote>