title: React native build failed Execution failed for task ':app:checkDebugDuplicateClasses'
body: <p>working with <strong>installreferrer</strong> and <strong><a href="https://payumobile.gitbook.io/sdk-integration/react-native/checkoutpro-wrapper" rel="nofollow noreferrer">payu</a></strong> sdk.iam new to react native tried to integrate payumobile for payment integradtion recieves error Execution failed for task ':app:checkDebugDuplicateClasses'.</p>
  <p>```
  FAILURE: Build failed with an exception.</p>
  <pre><code>*  What went wrong:
  Execution failed for task ':app:checkDebugDuplicateClasses'.
  &gt; 1 exception was raised by workers:
    java.lang.RuntimeException: Duplicate class com.google.android.a.a found in modules jetified-installreferrer-2.1-runtime.jar (com.android.installreferrer:installreferrer:2.1) and jetified-payu-gpay-1.3.3-runtime.jar (com.payu.gpay:payu-gpay:1.3.3)
    Duplicate class com.google.android.a.b found in modules jetified-installreferrer-2.1-runtime.jar (com.android.installreferrer:installreferrer:2.1) and jetified-payu-gpay-1.3.3-runtime.jar (com.payu.gpay:payu-gpay:1.3.3)
    Duplicate class com.google.android.a.c found in modules jetified-installreferrer-2.1-runtime.jar (com.android.installreferrer:installreferrer:2.1) and jetified-payu-gpay-1.3.3-runtime.jar (com.payu.gpay:payu-gpay:1.3.3)```
  </code></pre>
  <p>android/build.gradle</p>
  <pre><code>    buildscript {
          ext {
              buildToolsVersion = &quot;29.0.2&quot;
              minSdkVersion = 21
              compileSdkVersion = 29
              targetSdkVersion = 29
              kotlinVersion = &quot;1.3.72&quot;
              androidXCore = &quot;1.0.2&quot;
          }
          repositories {
              google()
              jcenter()
          }
          dependencies {
              classpath 'com.android.tools.build:gradle:4.0.2'
              classpath 'com.google.gms:google-services:4.3.3'
              classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion&quot;
      //        classpath 'com.google.firebase:perf-plugin:1.3.1'
              // NOTE: Do not place your application dependencies here; they belong
              // in the individual module build.gradle files
          }
      }
      
      allprojects {
          repositories {
              mavenLocal()
              maven {
                  // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                  url(&quot;$rootDir/../node_modules/react-native/android&quot;)
              }
              maven {
                  // Android JSC is installed from npm
                  url(&quot;$rootDir/../node_modules/jsc-android/dist&quot;)
              }
              // ADD THIS
              maven { url 'https://maven.google.com' }
      
              // ADD THIS
              maven { url &quot;https://www.jitpack.io&quot; }
              maven { url 'https://maven.fabric.io/public' }
              maven {
                  url &quot;https://sdk.smartlook.com/android/release&quot;
              }
              maven { url &quot;https://phonepe.bintray.com/PhonePeIntentSDK&quot; }
              google()
              jcenter()
          }
      } 
  
  </code></pre>
  <p>i have added dependency in app build.gradle it throws error
  android/app/build.gradle</p>
  <pre><code>
      android {
          compileSdkVersion rootProject.ext.compileSdkVersion
      
          compileOptions {
              sourceCompatibility JavaVersion.VERSION_1_8
              targetCompatibility JavaVersion.VERSION_1_8
          }
          dexOptions {
              preDexLibraries false
              javaMaxHeapSize &quot;4g&quot;
          }
      
          defaultConfig {
      
              missingDimensionStrategy 'react-native-camera', 'general'
      
              applicationId &quot;com.vakilsearch.crm&quot;
              minSdkVersion rootProject.ext.minSdkVersion
              targetSdkVersion rootProject.ext.targetSdkVersion
              vectorDrawables.useSupportLibrary = true   
      
          }
          lintOptions {
              abortOnError false
              checkReleaseBuilds false
          }
          splits {
              abi {
                  reset()
                  enable enableSeparateBuildPerCPUArchitecture
                  universalApk true  // If true, also generate a universal APK
      //            include &quot;armeabi-v7a&quot;, &quot;x86&quot;, &quot;arm64-v8a&quot;, &quot;x86_64&quot;
              }
          }
          signingConfigs {
              release {
                  storeFile file(MYAPP_RELEASE_STORE_FILE)
                  storePassword MYAPP_RELEASE_STORE_PASSWORD
                  keyAlias MYAPP_RELEASE_KEY_ALIAS
                  keyPassword MYAPP_RELEASE_KEY_PASSWORD
              }
          }
          buildTypes {
              release {
                  signingConfig signingConfigs.release
      //            minifyEnabled enableProguardInReleaseBuilds
      //            proguardFiles getDefaultProguardFile(&quot;proguard-android.txt&quot;), &quot;proguard-rules.pro&quot;
              }
              // dev is my added buildType
              dev {
                  initWith release
                  applicationIdSuffix &quot;.dev&quot;
                  matchingFallbacks = ['release']
              }
      
          }
      
          // 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:
                  // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
                  def versionCodes = [&quot;armeabi-v7a&quot;: 1, &quot;x86&quot;: 2, &quot;arm64-v8a&quot;: 3, &quot;x86_64&quot;: 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
                  }
              }
          }
      
          packagingOptions {
              exclude 'META-INF/services/javax.annotation.processing.Processor'
      
              pickFirst &quot;lib/armeabi-v7a/libc++_shared.so&quot;
              pickFirst &quot;lib/arm64-v8a/libc++_shared.so&quot;
              pickFirst &quot;lib/x86/libc++_shared.so&quot;
              pickFirst &quot;lib/x86_64/libc++_shared.so&quot;
          }
          // configurations {
          //     all { // You should exclude one of them for dublicate error
          //         exclude group: &quot;com.google.android.a.a&quot;, module: &quot;com.payu.gpay:payu-gpay:1.3.3&quot;
          //     }
          // }
      } 
          dependencies {
          implementation fileTree(dir: &quot;libs&quot;, include: [&quot;*.jar&quot;])
          //noinspection GradleDynamicVersion
          implementation &quot;com.facebook.react:react-native:+&quot;  // From node_modules
          implementation &quot;androidx.swiperefreshlayout:swiperefreshlayout:1.1.0&quot;
      
          debugImplementation(&quot;com.facebook.flipper:flipper:${FLIPPER_VERSION}&quot;) {
              exclude group: 'com.facebook.fbjni'
          }
      
          debugImplementation(&quot;com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}&quot;) {
              exclude group: 'com.facebook.flipper'
              exclude group:'com.squareup.okhttp3', module:'okhttp'
          }
      
          debugImplementation(&quot;com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}&quot;) {
              exclude group: 'com.facebook.flipper'
          }
          implementation 'com.google.firebase:firebase-appindexing:19.1.0'
          implementation 'com.google.firebase:firebase-core:17.5.1'
          implementation 'com.google.firebase:firebase-messaging:20.3.0'
          implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
          implementation 'com.google.android.gms:play-services-gcm:17.0.0'
          implementation 'com.google.android.gms:play-services-analytics:17.0.0'
      //    implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
          implementation 'com.android.support:appcompat-v7:28.0.0'
          implementation 'com.android.support:support-v4:28.0.0'
          implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion&quot;
          implementation 'androidx.appcompat:appcompat:1.2.0'
          implementation 'androidx.annotation:annotation:1.1.0'
          implementation 'com.facebook.fresco:fresco:2.2.0'
          implementation 'com.facebook.fresco:animated-gif:2.0.0'
          // Firebase dependencies (INSERT THIS)
          //this overrides the sdk play services dependency, without the app crashes, because there can only be one version of google play services
          // implementation 'com.google.android.gms:play-services-base:17.1.0'
          //webengage
          implementation 'com.webengage:android-sdk:3.+'
      //    implementation 'com.google.android.gms:play-services-ads:19.1.0'
          implementation 'com.android.installreferrer:installreferrer:2.1'
          implementation 'com.payu.india:payu-checkout-pro:1.1.1' 
          if (enableHermes) {
              def hermesPath = &quot;../../node_modules/hermes-engine/android/&quot;;
              debugImplementation files(hermesPath + &quot;hermes-debug.aar&quot;)
              releaseImplementation files(hermesPath + &quot;hermes-release.aar&quot;)
          } else {
              implementation jscFlavor
          }
      
      
      }
  
  </code></pre>