Author Topic: Conversion to Dalvik format failed with error 1  (Read 2262 times)

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Conversion to Dalvik format failed with error 1
« on: August 18, 2011, 10:34:11 pm »
What is that error? How do I solve it?

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: Conversion to Dalvik format failed with error 1
« Reply #1 on: August 18, 2011, 11:29:41 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Conversion to Dalvik format failed with error 1
« Reply #2 on: August 19, 2011, 07:33:03 am »
Quote
already added: Lcom/threed/jpct/util/MemoryHelper;
...maybe you've somehow added jPCT-AE twice in some way?

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: Conversion to Dalvik format failed with error 1
« Reply #3 on: August 19, 2011, 07:49:06 am »
No, there's only one reference to it. But even if there had been two, I hope Eclipse is smarter than that.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: Conversion to Dalvik format failed with error 1
« Reply #5 on: August 19, 2011, 06:54:47 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: Conversion to Dalvik format failed with error 1
« Reply #6 on: August 19, 2011, 07:21:20 pm »
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.

Offline primosz67

  • byte
  • *
  • Posts: 17
    • View Profile
Re: Conversion to Dalvik format failed with error 1
« Reply #7 on: February 17, 2013, 12:47:09 pm »
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.