简体   繁体   English

适用于Android的Cocos2d:转换为Dalvik格式失败,错误1

[英]Cocos2d for Android: Conversion to Dalvik format failed with error 1

This is my first time using Cocos2d for android and I am trying to integrate it as a library from source code(I haven't tried the jar file yet). 这是我第一次使用Cocos2d for android,我试图将它作为源代码库集成(我还没有尝试过jar文件)。 when trying to run the application he following error occurs: 尝试运行应用程序时,他会发生以下错误:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/cocos2d/actions/interval/CCSpawn;
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.dx.command.dexer.Main.run(Main.java:206)
[2012-07-21 14:26:37 - TestingCocos] Dx     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2012-07-21 14:26:37 - TestingCocos] Dx     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2012-07-21 14:26:37 - TestingCocos] Dx     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2012-07-21 14:26:37 - TestingCocos] Dx     at java.lang.reflect.Method.invoke(Unknown Source)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:180)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:703)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:577)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:282)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.resources.Project$1.run(Project.java:545)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:524)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.resources.Project.build(Project.java:123)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1000)
[2012-07-21 14:26:37 - TestingCocos] Dx     at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:924)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1128)
[2012-07-21 14:26:37 - TestingCocos] Dx     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-07-21 14:26:37 - TestingCocos] Dx 1 error; aborting
[2012-07-21 14:26:37 - TestingCocos] Conversion to Dalvik format failed with error 1

I recently upgraded to ADT20. 我最近升级到ADT20。 so I hope this isn't some related problem. 所以我希望这不是一些相关的问题。

This isn't a problem running the app, it's a problem building it. 这不是运行应用程序的问题,这是构建它的问题。 It looks like you've managed to include the same class in two different places (eg maybe both in the app and a library). 看起来你已经设法在两个不同的地方包含相同的类(例如,可能在应用程序和库中)。 The class's name is org.cocos2d.actions.interval.CCSpawn . 该类的名称是org.cocos2d.actions.interval.CCSpawn dx doesn't have the prettiest error messages, but they're usually at least somewhat informative! dx没有最漂亮的错误消息,但它们通常至少在某种程度上提供了信息!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM