2

As part of a collaborative project, I have been given 8 jars which give me access to an API. I unfortunately do not have access to the source of these jars.

I can include all the jars when I build a standard Java executable, no problem.

On Android, on the other hand, dexing causes a problem. If I add all the jars (or a certain subset) I get java.util.zip.ZipException: duplicate entry: org/josql/Query.class (or similar errors) at build time. My understanding is that that several libraries are exporting the same classes.

If I miss out several of the jars, it builds fine, but I obviously get a Could not find class or a java.lang.NoClassDefFoundError error at runtime.

Is there any way I can include all my jars but prevent the duplicate classes being dexed. I had a look at configurations { all*.exclude group: '', module: '' } option in gradle, but I can't seem to progress with that.

Is there some other way of resolving this problem? Note: I may not need all the jars for the functionality I'm calling. But I can't work out which ones I might need.

rod
  • 3,403
  • 4
  • 19
  • 25
  • I believe I may have found a possible solution, through the earlier question found here: http://stackoverflow.com/questions/23838362/gradle-how-to-exclude-javax-realtime-package-from-jscience-jar-dependency-mult – rod Apr 09 '15 at 17:26

0 Answers0