So I get this error from time to time. It’s at the application launching from the Run button in Eclipse. this occurs once every 4-5 times.
Anyone has an idea what’s going on.
I really appreciate it!
05-01 18:08:31.109: W/dalvikvm(15491): threadid=1: thread exiting with uncaught exception (group=0x40a311f8)
05-01 18:08:31.109: E/AndroidRuntime(15491): FATAL EXCEPTION: main
05-01 18:08:31.109: E/AndroidRuntime(15491): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3938)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.ActivityThread.access$1300(ActivityThread.java:123)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.os.Looper.loop(Looper.java:137)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-01 18:08:31.109: E/AndroidRuntime(15491): at java.lang.reflect.Method.invokeNative(Native Method)
05-01 18:08:31.109: E/AndroidRuntime(15491): at java.lang.reflect.Method.invoke(Method.java:511)
05-01 18:08:31.109: E/AndroidRuntime(15491): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-01 18:08:31.109: E/AndroidRuntime(15491): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-01 18:08:31.109: E/AndroidRuntime(15491): at dalvik.system.NativeStart.main(Native Method)
05-01 18:08:31.109: E/AndroidRuntime(15491): Caused by: java.lang.NullPointerException
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
05-01 18:08:31.109: E/AndroidRuntime(15491): at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
05-01 18:08:31.109: E/AndroidRuntime(15491): ... 11 more
Looked into the ICS source code – It seems like for whatever reason the Package Manager can’t get your package info – it could just be an eclipse/ADT bug where eclipse holds some kind of lock on the file, but whatever it is, it doesn’t seem like something that you could cause with your code. I would suggest running a clean, uninstalling the app from the emulator/device, or if those don’t work, you might try a fresh eclipse workspace.
Another thing that might be an issue is if you’re using a Library project – try unlinking the two, cleaning, and then linking them back up again – but thats it for my bag o’ tricks 🙂
UPDATE: yorkw gives a better explanation for why this occurs and its resolution here: RuntimeException: Unable to instantiate application