JP Hellemons
JP Hellemons

Reputation: 6057

Trouble debugging Android application: ClassNotFoundException

I have made my first android app. It works fine locally. But when I upload it to the market, somehow people have problems with it. I cannot figure out what went wrong. Even when I have the stack trace:

java.lang.RuntimeException: Unable to instantiate application com.jphellemons.koopzondag.Koopzondag: java.lang.ClassNotFoundException: com.jphellemons.koopzondag.Koopzondag in loader dalvik.system.PathClassLoader[/data/app/com.jphellemons.koopzondag-2.apk]
at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:715)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4615)
at android.app.ActivityThread.access$3000(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2223)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:5068)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.jphellemons.koopzondag.Koopzondag in loader dalvik.system.PathClassLoader[/data/app/com.jphellemons.koopzondag-2.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
at android.app.Instrumentation.newApplication(Instrumentation.java:945)
at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:706)

Please let me know if i have to show the manifest and/or source code? I really have no idea I will update this thread if I have the answer!

I have read about this issue here: java.lang.ClassNotFoundException on working app

So I guess that my fault is a setting in this window: can someone help me out with that?

enter image description here

Edit: I changed the first class from helloandroid.java to koopzondag.java and now i have the classcastexception. so I renamed the complete project. but now it can't launch the resource?

edit2 : Looks like this is the issue: but how do I resolve it? http://androidforums.com/application-development/216707-classcastexception-starting-activity.html#post1905263

Upvotes: 3

Views: 2345

Answers (3)

JP Hellemons
JP Hellemons

Reputation: 6057

the answer: android classcastexception on activity startup

Quote from Maxim:

  1. Open AndroidManifest.xml

  2. Find tag application

  3. Remove attribute android:name (if exists)

  4. Add attribute android:name="android.app.Application"

Upvotes: 0

Phyrum Tea
Phyrum Tea

Reputation: 2653

If you are using Android API Level higher than the phones are supporting, you'll get Runtime exceptions.

You seem to use API Level 8, have you specified the right levels in the manifest file?

Upvotes: 0

Macarse
Macarse

Reputation: 93173

If you are using additional jars, you need to add those to the /libs folder.

Upvotes: 1

Related Questions