Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt build failing with "UNEXPECTED TOP-LEVEL EXCEPTION (already added)"
    text
    copied!<p>I've seen a lot of threads about this error, but none that cover my strange scenario. First the basics:</p> <p>I've got 6 projects, all of which are scaled down test projects that mimic my application's structure and which I'm using just to try to get the build working. Their dependencies are as follows:</p> <ul> <li><em>exampleLib</em> is a library that requires no other jars <ul> <li>contains Widget.java</li> </ul></li> <li><em>exampleLib2</em> is a library that requires no other jars <ul> <li>contains Widget2.java</li> </ul></li> <li><em>exampleLibNester</em> is a library that requires <em>exampleLib</em> and <em>exampleLib2</em> <ul> <li>contains WidgetPartDeux.java</li> </ul></li> <li><em>exampleLibNester2</em> is a library that requires <em>exampleLib</em>, <em>exampleLib2</em>, and <em>exampleLibNester</em> <ul> <li>contains WidgetPartDeux2.java</li> </ul></li> <li><em>exampleUser</em> is an application that requires <em>exampleLib</em>, <em>exampleLib2</em>, <em>exampleLibNester</em>, and <em>exampleLibNester2</em> <ul> <li>contains TheActivity.java</li> </ul></li> <li><em>exampleTest</em> is a test application that instruments <em>exampleUser</em> and requires <em>exampleLib</em>, <em>exampleLib2</em>, and <em>exampleLibNester</em> <ul> <li>contains WidgetTest.java</li> </ul></li> </ul> <p>When I build these applications using ant locally on windows they run fine and I can use <code>install test</code> to run the tests. When I try to build them on my CI server, which is running linux, I get the dreaded "already added" error message.</p> <pre><code>-dex: [dex] Converting compiled files and external libraries into /apps/pos360/jenkins/.hudson/jobs/James-Test/exampleLibUser/bin/classes.dex... [dx] [dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] java.lang.IllegalArgumentException: already added: Lcom/example/nester/WidgetPartDeux; [dx] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123) [dx] at com.android.dx.dex.file.DexFile.add(DexFile.java:163) [dx] at com.android.dx.command.dexer.Main.processClass(Main.java:486) [dx] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455) [dx] at com.android.dx.command.dexer.Main.access$400(Main.java:67) [dx] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394) [dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245) [dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131) [dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109) [dx] at com.android.dx.command.dexer.Main.processOne(Main.java:418) [dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329) [dx] at com.android.dx.command.dexer.Main.run(Main.java:206) [dx] at com.android.dx.command.dexer.Main.main(Main.java:174) [dx] at com.android.dx.command.Main.main(Main.java:91) [dx] [dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] java.lang.IllegalArgumentException: already added: Lcom/example/lib/Widget; [dx] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123) [dx] at com.android.dx.dex.file.DexFile.add(DexFile.java:163) [dx] at com.android.dx.command.dexer.Main.processClass(Main.java:486) [dx] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455) [dx] at com.android.dx.command.dexer.Main.access$400(Main.java:67) [dx] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394) [dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245) [dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131) [dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109) [dx] at com.android.dx.command.dexer.Main.processOne(Main.java:418) [dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329) [dx] at com.android.dx.command.dexer.Main.run(Main.java:206) [dx] at com.android.dx.command.dexer.Main.main(Main.java:174) [dx] at com.android.dx.command.Main.main(Main.java:91) [dx] 2 errors; aborting </code></pre> <p>I can look in the classes.jar files and see that exampleLibNester2 is pulling those classes into its jars, but I don't know how to prevent it from doing that nor why it does it on the linux box but not the windows one. Both SDKs have been updated to the latest version.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload