title: Error while compiling React-native duplicate entry: javax/inject/Inject.class
body: <p>I downloaded a React-native project from the web called <a href="https://github.com/jetbridge-io/react-native-obd2" rel="nofollow noreferrer">react-native-obd2</a>. Before I got started I just wanted to run the example that was already given in the repo but while running <code>react-native run-android</code> I am getting stuck at an error.</p>
  
  <pre><code>:app:transformClassesWithJarMergingForDebug FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
  &gt; com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/inject/Inject.class
  </code></pre>
  
  <p>I have been breaking my head for over 3 hours to solve this bugger but it wouldn't go. </p>
  
  <p>I have tried various solutions one of the most logical solution to me was that <code>javax/inject/Inject.class</code> is being called twice somewhere. </p>
  
  <p>So I typed this command to get the gradle classpath.<br>
  <code>./gradlew -q dependencies app:dependencies --configuration compile</code></p>
  
  <pre><code>compile - Classpath for compiling the main sources.
  +--- project :react-native-obd2
  |    +--- com.android.support:appcompat-v7:23.0.1 -&gt; 24.1.0
  |    |    +--- com.android.support:animated-vector-drawable:24.1.0
  |    |    |    \--- com.android.support:support-vector-drawable:24.1.0
  |    |    |         \--- com.android.support:support-v4:24.1.0
  |    |    |              \--- com.android.support:support-annotations:24.1.0
  |    |    +--- com.android.support:support-v4:24.1.0 (*)
  |    |    \--- com.android.support:support-vector-drawable:24.1.0 (*)
  |    +--- com.facebook.react:react-native:+ -&gt; 0.34.1
  |    |    +--- javax.inject:javax.inject:1
  |    |    +--- com.android.support:appcompat-v7:23.0.1 -&gt; 24.1.0 (*)
  |    |    +--- com.android.support:recyclerview-v7:23.0.1 -&gt; 24.1.0
  |    |    |    +--- com.android.support:support-v4:24.1.0 (*)
  |    |    |    \--- com.android.support:support-annotations:24.1.0
  |    |    +--- com.facebook.fresco:fresco:0.11.0
  |    |    |    +--- com.facebook.fresco:drawee:0.11.0
  |    |    |    |    +--- com.android.support:support-v4:23.2.1 -&gt; 24.1.0 (*)
  |    |    |    |    \--- com.facebook.fresco:fbcore:0.11.0
  |    |    |    +--- com.facebook.fresco:fbcore:0.11.0
  |    |    |    \--- com.facebook.fresco:imagepipeline:0.11.0
  |    |    |         +--- com.android.support:support-v4:23.2.1 -&gt; 24.1.0 (*)
  |    |    |         +--- com.facebook.fresco:fbcore:0.11.0
  |    |    |         +--- com.parse.bolts:bolts-tasks:1.4.0
  |    |    |         +--- com.nineoldandroids:library:2.4.0
  |    |    |         \--- com.facebook.fresco:imagepipeline-base:0.11.0
  |    |    |              +--- com.android.support:support-v4:23.2.1 -&gt; 24.1.0 (*)
  |    |    |              +--- com.facebook.fresco:fbcore:0.11.0
  |    |    |              +--- com.parse.bolts:bolts-tasks:1.4.0
  |    |    |              \--- com.nineoldandroids:library:2.4.0
  |    |    +--- com.facebook.fresco:imagepipeline-okhttp3:0.11.0
  |    |    |    +--- com.facebook.fresco:fbcore:0.11.0
  |    |    |    +--- com.squareup.okhttp3:okhttp:3.0.1 -&gt; 3.4.1
  |    |    |    |    \--- com.squareup.okio:okio:1.9.0
  |    |    |    \--- com.facebook.fresco:imagepipeline:0.11.0 (*)
  |    |    +--- com.facebook.soloader:soloader:0.1.0
  |    |    +--- com.fasterxml.jackson.core:jackson-core:2.2.3
  |    |    +--- com.google.code.findbugs:jsr305:3.0.0
  |    |    +--- com.squareup.okhttp3:okhttp:3.4.1 (*)
  |    |    +--- com.squareup.okhttp3:okhttp-urlconnection:3.4.1
  |    |    |    \--- com.squareup.okhttp3:okhttp:3.4.1 (*)
  |    |    +--- com.squareup.okhttp3:okhttp-ws:3.4.1
  |    |    |    \--- com.squareup.okhttp3:okhttp:3.4.1 (*)
  |    |    +--- com.squareup.okio:okio:1.9.0
  |    |    \--- org.webkit:android-jsc:r174650
  |    +--- com.github.pires:obd-java-api:1.0-RC16
  |    \--- org.roboguice:roboguice:3.+ -&gt; 3.0.1
  +--- project :react-native-vector-icons
  |    \--- com.facebook.react:react-native:+ -&gt; 0.34.1 (*)
  +--- project :react-native-sp
  |    +--- com.android.support:appcompat-v7:23.0.1 -&gt; 24.1.0 (*)
  |    \--- com.facebook.react:react-native:+ -&gt; 0.34.1 (*)
  +--- project :react-native-sensor-manager
  |    \--- com.facebook.react:react-native:0.12.+ -&gt; 0.34.1 (*)
  +--- project :react-native-dialogs
  |    +--- com.facebook.react:react-native:0.20.+ -&gt; 0.34.1 (*)
  |    \--- com.github.afollestad.material-dialogs:commons:0.8.6.2
  |         +--- com.android.support:appcompat-v7:24.1.0 (*)
  |         \--- com.github.afollestad.material-dialogs:core:0.8.6.2
  |              +--- com.android.support:appcompat-v7:24.1.0 (*)
  |              +--- com.android.support:recyclerview-v7:24.1.0 (*)
  |              +--- com.android.support:support-v4:24.1.0 (*)
  |              +--- me.zhanghai.android.materialprogressbar:library:1.1.7
  |              |    +--- com.android.support:appcompat-v7:24.0.0 -&gt; 24.1.0 (*)
  |              |    \--- com.android.support:support-annotations:24.0.0 -&gt; 24.1.0
  |              \--- com.android.support:support-annotations:24.1.0
  +--- com.android.support:appcompat-v7:23.0.1 -&gt; 24.1.0 (*)
  \--- com.facebook.react:react-native:+ -&gt; 0.34.1 (*)
  </code></pre>
  
  <p>but I don't see javax written twice. 
  It was also mentioned that check the versions of the downloaded project and your file but I couldn't find any significant difference. </p>
  
  <p>Here is the build.gradle  </p>
  
  <pre><code>apply plugin: "com.android.application"
  
  import com.android.build.OutputFile
  apply from: "../../node_modules/react-native/react.gradle"
  
  def enableSeparateBuildPerCPUArchitecture = false
  
  /**
   * Run Proguard to shrink the Java bytecode in release builds.
   */
  def enableProguardInReleaseBuilds = false
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.1"
  
      defaultConfig {
          applicationId "com.obd2example"
          minSdkVersion 16
          targetSdkVersion 22
          versionCode 1
          versionName "1.0"
          multiDexEnabled true
          ndk {
              abiFilters "armeabi-v7a", "x86"
          }
      }
      splits {
          abi {
              reset()
              enable enableSeparateBuildPerCPUArchitecture
              universalApk false  // If true, also generate a universal APK
              include "armeabi-v7a", "x86"
          }
      }
      buildTypes {
          release {
              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:
              // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
              def versionCodes = ["armeabi-v7a":1, "x86":2]
              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
              }
          }
      }
  }
  
  repositories {
      maven { url "https://jitpack.io" }
  }
  
  dependencies {
      compile project(':react-native-obd2')
      compile project(':react-native-vector-icons')
      compile project(':react-native-sp')
      compile project(':react-native-sensor-manager')
      compile project(':react-native-dialogs')
      compile fileTree(dir: "libs", include: ["*.jar"])
      compile "com.android.support:appcompat-v7:23.0.1"
      compile "com.facebook.react:react-native:+"  // From node_modules
  }
  
  // Run this once to be able to run the application with BUCK
  // puts all compile dependencies into folder libs for BUCK to use
  task copyDownloadableDepsToLibs(type: Copy) {
      from configurations.compile
      into 'libs'
  }
  </code></pre>
  
  <p>Could anyone please guide me where to look?</p>
  
  <p><strong>EDIT 1</strong><br>
  In my quest to find out where javax.inject module was used twice I did a grep -r "javax.inject" in the node_modules folder and found this</p>
  
  <pre><code>react-native/android/com/facebook/react/react-native/0.34.1/react-native-0.34.1.pom:      &lt;groupId&gt;javax.inject&lt;/groupId&gt;
  react-native/android/com/facebook/react/react-native/0.34.1/react-native-0.34.1.pom:      &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
  react-native/ReactAndroid/src/main/third-party/java/jsr-330/BUCK:    url = 'mvn:javax.inject:javax.inject:jar:1',
  react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java:import javax.inject.Provider;
  react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleSpec.java:import javax.inject.Provider;
  react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java:import javax.inject.Provider;
  react-native/ReactAndroid/build.gradle:    compile 'javax.inject:javax.inject:1'
  </code></pre>
  
  <p>Is there something wrong here? I am not very well versed with Java and gradle build system to comprehend it. </p>