title: Android Studio complains duplicate class
body: <p>I'm trying to generate an apk file but android studio is showing me the following error:</p>
  
  <blockquote>
    <p>Duplicate class
    com.google.android.gms.ads.identifier.AdvertisingIdClient found in
    modules classes.jar
    (com.google.android.gms:play-services-ads-identifier:17.0.0) and
    classes.jar (com.google.android.gms:play-services-analytics:7.8.0)
    Duplicate class
    com.google.android.gms.ads.identifier.AdvertisingIdClient$Info found
    in modules classes.jar
    (com.google.android.gms:play-services-ads-identifier:17.0.0) and
    classes.jar (com.google.android.gms:play-services-analytics:7.8.0)
    Duplicate class
    com.google.android.gms.ads.identifier.AdvertisingIdClient$zza found in
    modules classes.jar
    (com.google.android.gms:play-services-ads-identifier:17.0.0) and
    classes.jar (com.google.android.gms:play-services-analytics:7.8.0)</p>
  </blockquote>
  
  <p>It was working previously. I totally did not make any changes to the code. Can anyone help?</p>
  
  <p>Here is my build.gradle file:</p>
  
  <pre><code>apply plugin: "com.android.application"
  
  import com.android.build.OutputFile
  
  def jscFlavor = 'org.webkit:android-jsc:+'
  
  
  def enableHermes = project.ext.react.get("enableHermes", false);
  
  android {
  compileSdkVersion rootProject.ext.compileSdkVersion
  
  compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
  
  defaultConfig {
      applicationId "com.step_by_step.virq"
      minSdkVersion rootProject.ext.minSdkVersion
      targetSdkVersion rootProject.ext.targetSdkVersion
      versionCode 1
      versionName "1.0"
  }
  splits {
      abi {
          reset()
          enable enableSeparateBuildPerCPUArchitecture
          universalApk false  // If true, also generate a universal APK
          include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
      }
  }
  signingConfigs {
      debug {
          storeFile file('debug.keystore')
          storePassword 'android'
          keyAlias 'androiddebugkey'
          keyPassword 'android'
      }
  }
  buildTypes {
      debug {
          signingConfig signingConfigs.debug
      }
      release {
          // Caution! In production, you need to generate your own keystore file.
          // see https://facebook.github.io/react-native/docs/signed-apk-android.
          signingConfig signingConfigs.debug
          minifyEnabled enableProguardInReleaseBuilds
          proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
      }
  }
  // applicationVariants are e.g. debug, release
  applicationVariants.all { variant -&gt;
      variant.outputs.each { output -&gt;
          // For each separate APK per architecture, set a unique version code as described here:
          // https://developer.android.com/studio/build/configure-apk-splits.html
          def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
          def abi = output.getFilter(OutputFile.ABI)
          if (abi != null) {  // null for the universal-debug, universal-release variants
              output.versionCodeOverride =
                      versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
          }
  
      }
  }
  }
  
  dependencies {
  implementation project(':react-native-push-notification')
  implementation project(':react-native-firebase')
  implementation fileTree(dir: "libs", include: ["*.jar"])
  implementation "com.facebook.react:react-native:+"  // From node_modules
  implementation "com.google.android.gms:play-services-base:16.1.0"
  implementation "com.google.firebase:firebase-core:17.0.1"
  implementation "com.google.firebase:firebase-messaging:19.0.1"
  implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
  implementation "com.google.android.gms:play-services:7.8.0"
  
  if (enableHermes) {
      def hermesPath = "../../node_modules/hermes-engine/android/";
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
  } else {
      implementation jscFlavor
  }
  }
  
  task copyDownloadableDepsToLibs(type: Copy) {
  from configurations.compile
  into 'libs'
  }
  
  apply from: file("../../node_modules/@react-native-community/cli-platform- 
  android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
  apply plugin: "com.google.gms.google-services"
  </code></pre>