0

我正在尝试将外部 JAR 添加到我的项目中,但收到此错误:

--

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/codehaus/jackson/Base64Variant;
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:372)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:59)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:313)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.dx.command.dexer.Main.run(Main.java:185)
[2011-08-24 16:35:19 - MyProjApp] Dx at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
[2011-08-24 16:35:19 - MyProjApp] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2011-08-24 16:35:19 - MyProjApp] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:652)
[2011-08-24 16:35:19 - MyProjApp] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:510)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242)
[2011-08-24 16:35:19 - MyProjApp] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2011-08-24 16:35:19 - MyProjApp] Dx 1 error; aborting
[2011-08-24 16:35:19 - MyProjApp] **Conversion to Dalvik format failed with error 1**

--

我了解我添加的 jar 和库项目(Open-Feint 库)存在冲突。

我的问题是我是否可以做些什么来解决这个问题?

4

2 回答 2

3

我对 OpenFeint 库有同样的问题,我想通了。

如果您还包括 GameFeed 项目

项目 > 属性 > Android > 库

部分,您可能会包含两次 OpenFeint API 源代码,一次在 OpenFeint 库中,一次在 GameFeed 项目中作为依赖库。

我不得不从 GameFeed 项目中删除 OpenFeint API 源链接,然后一切正常。

底线是不知何故,您的项目中两次构建了一些源代码。

于 2011-12-03T18:49:01.030 回答
0

一个不太好的解决方案是检查双类文件是否是相同的确切版本,如果是,则从其中一个 jar 中删除它们......这是一种解决方法,但不是一个非常安全的解决方案......只做如果你必须。

于 2011-08-24T13:43:35.230 回答