Search This Blog

25 July 2010

ClassNotFoundException: org.eoti.MyAuthenticationService in loader dalvik.system.PathClassLoader

I came across an annoying thing today...  I install my app and use it.  I close it and reopen it a few times.  I use other things then come back and use it.  Everything is working fine.

Then I reboot.  Now, every time it tries to use the authentication mechanism, it force closes.  On the phone, it doesn't give any details at all in logCat.  On the emulator, I can't replicate it.

Or can I?  I go into Manage Applications and force close the app.  Launch it and voila, same thing.

Specifically, Account Manager's blockingGetAuthToken is trying to load the authentication class (which it used not more than 30 seconds ago) and I get this:
(slightly cleaned up stack)
W/dalvikvm(  550): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime(  550): FATAL EXCEPTION: main
E/AndroidRuntime(  550): java.lang.RuntimeException: Unable to instantiate service org.eoti.MyAuthenticationService: java.lang.ClassNotFoundException: org.eoti.MyAuthenticationService in loader dalvik.system.PathClassLoader[/data/app/org.eoti.test-1.apk]
E/AndroidRuntime(  550):        at android.app.ActivityThread.handleCreateService(ActivityThread.java:2943)
E/AndroidRuntime(  550):        at android.app.ActivityThread.access$3300(ActivityThread.java:125)
E/AndroidRuntime(  550):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2087)
E/AndroidRuntime(  550):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  550):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  550):        at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime(  550):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  550):        at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(  550):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(  550):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime(  550):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  550): Caused by: java.lang.ClassNotFoundException: org.eoti.MyAuthenticationService in loader dalvik.system.PathClassLoader[/data/app/org.eoti.test-1.apk]
E/AndroidRuntime(  550):        at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime(  550):        at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime(  550):        at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime(  550):        at android.app.ActivityThread.handleCreateService(ActivityThread.java:2940)
E/AndroidRuntime(  550):        ... 10 more
I/Process (  550): Sending signal. PID: 550 SIG: 9
I/ActivityManager(   59): Process org.eoti.test:main (pid 550) has died.

Ok... so it is able to load the classes... until a reboot (or force close)... and then it can't find them anymore?  If anyone has any thoughts on the matter, I'd be keen to hear them...

9 comments:

  1. It seems that perhaps I should sleep more.

    I didn't think twice about the classname because it was a valid classname YESTERDAY. That bit of code is never triggered during the first boot because of the static application reference. After boot (or force stop) then it tried to load the previous settings; which resulted it it not realizing the classname should have been changed.

    Solution: compare the error to your AndroidManifest very closely.

    ReplyDelete
  2. Nice blog, It's good to find someone, who is one step futher.

    ReplyDelete
  3. Well done guys, its really informative and helpful allot.

    ReplyDelete
  4. Hi Malachi, if you can elaborate the solution..

    ReplyDelete
  5. Hi Malachi,

    I am also faced same issue and found the solution.The problem is,this maps application uses maps library which needs to be mentioned in manifest file.While menioning this I mentioned out side of the application tag.Thats why error came.After that I moved the permission inside the apllication tag then issue got resolved.

    I think same can solve ur problem also.

    ReplyDelete
  6. Dear Malachi,
    Could you pin point the exact problem. I am unable to get around..:(

    ReplyDelete
  7. Hi Mudassir,

    I no longer have access to that version of the code. If I remember right, I think I had moved something but forgot to update the AndroidManifest so it no longer matched... or something like that.

    ReplyDelete
  8. Hariku ur fix did the trick for me. THanks

    ReplyDelete