本文介绍了Android的建筑工作在Eclipse,但不与蚂蚁("已添加")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid项目使用标示为Android的图书​​馆几个git的子模块。这些子模块都具有ORMlite的Andr​​oid罐子的不同用途,因此有包含在其目录下的ORMlite罐子。 Eclipse中正确处理这样的情况:它包括ORMlite罐子一旦 DEX 处理过程中,并产生一个有效的apk,但是当我通过运行构建蚂蚁调试,我得到:

My Android project uses several git submodules marked as Android Libraries. These submodules all have different uses of the ORMlite Android jars and thus have the ORMlite jars included in their libs directory. Eclipse handles this situation correctly: it includes the ORMlite jars once during the dex processing and generates a valid .apk, but when I run a build via ant debug, I get:

 [echo] Converting compiled files and external libraries into /home/webedit/.hudson/jobs/xyz/workspace/bin/classes.dex...
[apply]
[apply] UNEXPECTED TOP-LEVEL EXCEPTION:
[apply] java.lang.IllegalArgumentException: already added: Lcom/j256/ormlite/android/AndroidCompiledStatement;
[apply]     at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[apply]     at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[apply]     at com.android.dx.command.dexer.Main.processClass(Main.java:338)
[apply]     at com.android.dx.command.dexer.Main.processFileBytes(Main.java:315)
[apply]     at com.android.dx.command.dexer.Main.access$100(Main.java:56)
[apply]     at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:266)
[apply]     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[apply]     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[apply]     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[apply]     at com.android.dx.command.dexer.Main.processOne(Main.java:284)
[apply]     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:220)
[apply]     at com.android.dx.command.dexer.Main.run(Main.java:176)
[apply]     at com.android.dx.command.dexer.Main.main(Main.java:157)
[apply]     at com.android.dx.command.Main.main(Main.java:89)

有没有什么办法可以有相同的JAR在多个库撒的多个副本?是否有一个Ant构建设置我可以改变得到这个工作?

Is there any way to have multiple copies of the same JAR sprinkled across multiple libraries? Is there an Ant build setting I can change to get this to work?

推荐答案

我解决了创建第三个Android项目只用ORMlite JAR在这两个其他项目依赖于我的问题。

I solved my problem by creating a third Android project with only the ORMlite JAR in it that the two other projects depended on.

这篇关于Android的建筑工作在Eclipse,但不与蚂蚁("已添加")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 05:28