What is that error? How do I solve it?
I found that it's related to including a jar on Eclipse's build path. I can remove it and clean the project, but then obviously jPCT won't work!
The following is the entire console message:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/threed/jpct/util/MemoryHelper;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
at com.android.dx.command.dexer.Main.processClass(Main.java:372)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
at com.android.dx.command.dexer.Main.access$400(Main.java:59)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
at com.android.dx.command.dexer.Main.processOne(Main.java:313)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
at com.android.dx.command.dexer.Main.run(Main.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:652)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:510)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2011-08-18 17:33:38 - AndersonSilva] Dx 1 error; aborting
[2011-08-18 17:33:38 - AndersonSilva] Conversion to Dalvik format failed with error 1
Quote
already added: Lcom/threed/jpct/util/MemoryHelper;
...maybe you've somehow added jPCT-AE twice in some way?
No, there's only one reference to it. But even if there had been two, I hope Eclipse is smarter than that.
Google is your friend: http://groups.google.com/group/android-developers/browse_thread/thread/09d75a9a6af76843?pli=1 (http://groups.google.com/group/android-developers/browse_thread/thread/09d75a9a6af76843?pli=1)
I tried Googling, it didn't help. All I did was reference the jpct-ae jar in Project>Properties>Java Build Path>Libraries (as an external jar, at that). I don't see how this could reference it twice.
I solved it, although for the life of me I don't know how. It makes no sense, but in fiddling with it, I broke it further by detaching the project's name from the Run/Debug settings. In fixing that, the original problem was solved. Very weird.
yesterday i had the same problem my solution:
Project 1 (non android project):
[] jpct.jar
src,data etc.
Project 2 android (Order and export -eclipse juno ):
[checked] Android 4.2
[checked] Android Dependency
[checked] Project 1
[checked] jpct-ae.jar (/libs/)
src, data. etc.
in my case the most important thing was that the jpct-ae must be after the android lib and project 1 reference. Project 1 must be checked.