4

When I try to run this Android project in Eclipse Kepler 4.3.2 on Ubuntu 13.10. the dexer throws this ParseException:

$ Dx 
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: class name 
    (org/osmdroid/DefaultResourceProxyTest) does not match path 
    (target/test-classes/org/osmdroid/DefaultResourceProxyTest.class)

    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.processClass(Main.java:665)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
    at com.android.dx.command.dexer.Main.access$600(Main.java:78)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:596)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
    at com.android.dx.command.dexer.Main.run(Main.java:230)
    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:606)
    at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
    at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:786)
    at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:597)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:733)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:328)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
    at org.eclipse.core.internal.resources.Project.build(Project.java:124)
    at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1143)
    at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:155)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
...while parsing target/test-classes/org/osmdroid/DefaultResourceProxyTest.class

$ Dx 1 error; aborting
$ Conversion to Dalvik format failed with error 1
JJD
  • 50,076
  • 60
  • 203
  • 339
  • I think if you rebuild the library and exclude everything from the /gen directory, everything should work fine. – Roland Kákonyi May 06 '14 at 13:09
  • @RolandKákonyi How do I exclude everything from the `/gen` directory? – JJD May 06 '14 at 13:17
  • Check [this](http://stackoverflow.com/questions/6666979/eclipse-helios-cdt-ignore-build-directory/6669555#6669555). Did you tried a clean and build? It may be working – Roland Kákonyi May 06 '14 at 13:20
  • Also you should add to your _.gitignore_ file your _gen_ directory, but you must delete it and commit the deletion before the ignore. – Roland Kákonyi May 06 '14 at 13:21
  • @RolandKákonyi I defined the **exclude rule** as shown in [this screenshot](http://s29.postimg.org/fsv1epqcn/resource_filter.png) - it may be incorrect. The ParseException remains. – JJD May 06 '14 at 13:28
  • It should be like [this](http://s30.postimg.org/4vjlvognl/Screen_Shot_2014_05_06_at_15_30_19.png). Clean and build didn't helped? – Roland Kákonyi May 06 '14 at 13:32
  • @RolandKákonyi Same error still. Clean and build did not help. Try yourself - the sources are up there. – JJD May 06 '14 at 13:46
  • I tried, the error is related with – Roland Kákonyi May 06 '14 at 13:53
  • 1
    I tried, same here. The error is related with the osmdroid. I am not figured out yet. Did you upgraded from previous version of it? Did it work until now? What happened since? – Roland Kákonyi May 06 '14 at 13:55
  • @RolandKákonyi I just cloned the repository as it is. – JJD May 06 '14 at 14:00

2 Answers2

2

Right click the project in Eclipse, go to Java Build Path, click the Order and Export tab and uncheck "Android Private Libraries".

kurtzmarc
  • 3,110
  • 1
  • 24
  • 40
  • I am not sure if it the reason but after unchecking "Android Private Libraries" the app crashes with this error: `java.lang.NoClassDefFoundError: android.support.v4.content.LocalBroadcastManager`. – JJD May 09 '14 at 20:36
  • Let me suggest this - re-check the Android Private Libraries. Then remove the jar files from the libs folder and put them in a new folder (maybe just "lib"). Then add each jar file through the Java Build Path dialog. Uncheck each added jar in the "Order and Export" tab. – kurtzmarc May 09 '14 at 21:25
1

com.android.dx.cf.iface.ParseException: class name (example/igd/ConnectionInfoTest$1) does not match path (target/test-classes/example/igd/ConnectionInfoTest$1.class)

This is a problem I encountered!! I solve this problem by this method:

Properties->Java Bulid Path->Source->Output folder->Edit->Specific Output folder->Browse..

target/test-classes (target/classes) change to target

Because I have no wealth 10,so can't upload the picture!! 5555555enter image description here

Thanks!!!!

jiong103
  • 111
  • 7