2

I have a project named MyProject.

It includes 2 library projects abc.aar and xyz.aar.

These both library projects uses and have one common jar dummy.jar (package name: com.example.dummy).

When I include both library projects, it gives me

    android java.util.zip.ZipException: duplicate entry com/example/dummy/DummyClass$1.class

I have tried following things -

configurations {
    // to avoid double inclusion
    all*.exclude group: 'com.example.dummy'
}

and this too

compile (name:'abc', ext:'aar'){
    transitive = false
    exclude module: 'libs/dummy*.jar'
    exclude group: 'com.example.dummy'
    exclude module: 'com.example.dummy'
}

Please suggest to avoid double inclusion of dependency jar because of multiple dependency library project using same jar.

My both library projects are not on any repositories.

ADattatrey
  • 252
  • 2
  • 10
  • 3
    Possible duplicate of [java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex](http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult) – 2Dee Jan 20 '16 at 14:02
  • if library is in repositories configurations { // to avoid double inclusion all*.exclude group: 'com.example.dummy' } this solves the problem. But my libraries are not in repositories and moreover none of the solution from that question is working for me. :( – ADattatrey Jan 21 '16 at 05:40
  • Any luck with this? The only solution I've found for this situation is to explode the dependency, delete the offending jar and zip it back up. Of course then you'll also have to include the dependency locally. The compile dependency stuff won't work because that is just used to determine what dependencies to download. I think you may be able to do something with packagingOptions, but I've yet to get anything to work. – CaptRespect Nov 12 '16 at 15:06

0 Answers0