Thordax
Thordax

Reputation: 1733

Build Android project containing ActionBarSherlock with ant

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 ?

Upvotes: 0

Views: 1105

Answers (1)

mavixce
mavixce

Reputation: 338

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

Upvotes: 1

Related Questions