7

First, I have added a dependency in gradle, and then sync the project. We have no error, but when we run the application, we got an error which is also showing in the image.

    :app:transformClassesWithJarMergingForDebug FAILED
    Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/inject/Inject.class

We found a duplicate jar file with different version which is highlighted above. Now I want to remove only this duplicate jar file(java.inject-1). Hope someone has a solution for this.

AL.
  • 36,815
  • 10
  • 142
  • 281
Pankaj Gurjar
  • 73
  • 1
  • 1
  • 4
  • manually removing it is not the solution, next gradle sync it will be there again – Tim May 31 '16 at 06:40
  • yes, but i want to update gradle to exclude this file. – Pankaj Gurjar May 31 '16 at 06:48
  • 1
    like this :- configurations { all*.exclude group: 'javax.inject-1', module: 'org.igniterealtime:rest-api-client' all*.exclude module: 'java.inject' } but this is also not working for me – Pankaj Gurjar May 31 '16 at 06:48

3 Answers3

1

please try below in your gradle dependency.

compile('org.igniterealtime:rest-api-client:1.1.3')
{exclude module: "javax.inject"}
MinnuKaAnae
  • 1,646
  • 3
  • 23
  • 35
0

You can close Android Studio, delete all the .idea folders and .iml files in your project and re-import.

TDG
  • 5,909
  • 3
  • 30
  • 51
  • 5
    Go to Project Structure > app> dependencies. at the right hand side you will see + and - select library which you want to delete and click on - button. – Pradeep Deshmukh May 31 '16 at 07:04
  • Hello pradeep my case is something different, please check my attached image http://i.stack.imgur.com/XJtjn.png – Pankaj Gurjar May 31 '16 at 07:08
  • simply remove "compile files('libs/android-support-v13.jar')" form "dependencies" in my "build.gradle (Module: app) Try this sort of stuff – Garima Mishra May 31 '16 at 08:30
0

If you are using Android Studio Use Refactor. Just

Right Click the .jar file choose "Refactor > safe delete"

.

MinnuKaAnae
  • 1,646
  • 3
  • 23
  • 35
iSandeep
  • 597
  • 8
  • 24