Android Build fail - java.lang.IllegalArgumentException: 已添加: Lcom/google/api/client/escape/CharEscapers;

2022-08-31 16:56:41

我只是为我的Android应用程序准备了小的更新,但是当我尝试构建我的应用程序(在调试模式下)时,我遇到了这个奇怪的错误。如果更聪明的人可以看看这个来找出可能出了什么问题,那就太好了。我正在清理/重建/修复项目属性,但没有结果。我不知道:(发生了什么。也许类似的事情发生在这里的任何人身上?如果这可以帮助我,我使用以下库:adMob(4.1.1),openfeint和libgdx。

这里是构建日志:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/api/client/escape/CharEscapers;
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.dx.command.dexer.Main.run(Main.java:206)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at java.lang.reflect.Method.invoke(Method.java:616)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:745)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:647)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:282)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Project$1.run(Project.java:545)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:524)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.resources.Project.build(Project.java:123)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.project.ProjectHelper.build(ProjectHelper.java:869)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:146)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:924)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1128)
[2011-12-08 21:56:42 - JellyBallsFree] Dx   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2011-12-08 21:56:42 - JellyBallsFree] Dx 1 error; aborting
[2011-12-08 21:56:42 - JellyBallsFree] Conversion to Dalvik format failed with error 1

答案 1

您包含两次相同的 jar 库。检查您的应用程序和所有引用的Android库,并确保所有jar都只包含一次。

如果这没有帮助,请查看 http://tools.android.com/knownissues。具体看一下构建系统部分中描述的第一个问题。

您也可以阅读这篇文章: 如何修复“转换为Dalvik格式失败,错误1”


答案 2

升级到R17后收到此错误。

我的原因不同(即不是R15中发生的*_src问题)。我的“libs”文件夹中有两个不同版本的库。看起来Android插件现在会自动将“libs”中的任何jar添加到包资源管理器中的“Android依赖项”部分。移除旧罐子解决了问题。


推荐