0
votes

I'm having trouble using Ant to build my project containing ActionBarSherlock.

Actually, the remaining bug during the compilation is as following

-dex:
      [dex] Converting compiled files and external libraries into C:\ProjetsECLIPSE\SEMobile_BP\bin\classes.dex...
       [dx] 
       [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
       [dx] java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/Watson$OnCreateOptionsMenuListener;
       [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] 1 error; aborting

I removed every file "android-supportv4.jar" of my libs folders, and in Eclipse, I made sure there was not a link to this library on my libraries and on my main project, but the error still remains.

I can build my project via Eclipse, but Ant cannot build it (in debug or in release mode).

I tried ant clean and it doesn't change anything.

How to avoid this frustrating error ?

1
Do you have more than one Android library project (i.e., ActionBarSherlock plus something else)? Are you on a current version of the developer tools?CommonsWare
I use the ADT on version 20, and I actually have more than one library for my project. I have : - my application linked to one library, and this one library linked to actionBarSherlockThordax
Hmmm... if there were more than one copy of the JAR, that should trigger the build tools to detect and either ignore or complain about the duplicate, with R20. Not sure what you are running into.CommonsWare
Did I miss something when i "ant update project" my libraries ? Should I update them as librairies in order to make them work ?Thordax

1 Answers

1
votes

Check your project's libs folder and if there is duplicate jar remove it. I found actionbarsherlock.jar in my project's libs folder and after i'd deleted it, problem solved.

Also check those out; this blog, this question, and this page