views:

263

answers:

2

Hey y'all,

So I ran into a problem today while working on my Android program. I have a class that turns that an XML string into a Java object (third party) and it works fine in as a regular java project but on Android I get this weird error:

06-21 22:44:26.402: DEBUG/App(259): java.lang.ClassNotFoundException: com.package.mycode.Class in loader dalvik.system.PathClassLoader@4001b500 06-21 22:44:26.402: DEBUG/App(259): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)

I hide my application name and my package for obvious reasons but I was wondering if anyone has ever encountered problems like this. Class is in the correct package, which is a library I have added. Other classes that I reference before are there and those can be made. Are there any other reasons a ClassNotFound Exception is thrown?

Thanks, Jake

A: 

Are there any other reasons a ClassNotFoundException is thrown?

IIRC, it can also be thrown if some other class in the static dependencies of "com.package.mycode.Class" cannot be loaded, or if there is a problem during static initialization. But these should show up as a nested exception ... the first time you attempt to load the class.

Stephen C
A: 

Android has not all Java classes available that are available on a normal machine. There are some classes missing that could cause this error. But this should be already be shown at compile time. Look at this list to see which classes are supported and which are not supported.

Again I'm only guessing because the compiler should see the missing classes.

Janusz
I dont have any other the classes being imported or being relied on that are not supported. And the file that is trying to be loaded is part of a jar file I created so it compiles fine with the other jar files. I hope I got what you meant
Jake Schwartz
Where have you put this jar file in your android project?
Janusz