IllegalArgumentException: already added Lcom/google/inject/AbstractModule when building Android app on IntelliJ 90.193

I'm trying to build an android application using IntelliJ 90.193.  When I build I get the following error:

Information:Compilation completed with 17 errors and 19 warnings

Information:17 errors

Information:19 warnings

Error:UNEXPECTED TOP-LEVEL EXCEPTION:

Error:java.lang.IllegalArgumentException: already added: Lcom/google/inject/AbstractModule;

Error: at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)

Error: at com.android.dx.dex.file.DexFile.add(DexFile.java:143)

Error: at com.android.dx.command.dexer.Main.processClass(Main.java:299)

Error: at com.android.dx.command.dexer.Main.processFileBytes(Main.java:276)

Error: at com.android.dx.command.dexer.Main.access$100(Main.java:56)

Error: at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:228)

Error: at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)

Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)

Error: at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)

Error: at com.android.dx.command.dexer.Main.processOne(Main.java:245)

Error: at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)

Error: at com.android.dx.command.dexer.Main.run(Main.java:139)

Error: at com.android.dx.command.dexer.Main.main(Main.java:120)

Error: at com.android.dx.command.Main.main(Main.java:87)

Error:1 error; aborting


My application depends on another module called roboguice.  The roboguice module has a dependency on guice-2.0-no_aop.jar.  My application has a dependency on the same jar.

It appears that the Android plugin is attempting to dex the jar twice, which results in the above error.

If I remove the dependency from either the roboguice module or the application module, the problem goes away and the application is built properly.  But doing so means that I get compilation errors the next time I try to compile the module that I modified.

Do I have something configured incorrectly?  Is there a way I can fix this?

Cheers,
Mike
2 comments
Comment actions Permalink

Same started happening to me after upgrade to 10.5
I also have a library Android module and getting few of these. I even recreated all modules from scratch, but no success.

0
Comment actions Permalink

Have you checked the contents of your "libs" folder?  My issue was that I still had the jar on which I depended in the "libs" folder of my Android project.  Once I removed it from there it was smooth sailing. HTH

0

Please sign in to leave a comment.