1

When running an Android application, I get these errors, but everything actually works fine on the device. What's that means? And how to get rid of them ?

07-20 11:09:38.119: E/AndroidRuntime(930): FATAL EXCEPTION: main
07-20 11:09:38.119: E/AndroidRuntime(930): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3909)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.ActivityThread.access$1300(ActivityThread.java:122)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1184)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.os.Looper.loop(Looper.java:137)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.ActivityThread.main(ActivityThread.java:4340)
07-20 11:09:38.119: E/AndroidRuntime(930):  at java.lang.reflect.Method.invokeNative(Native Method)
07-20 11:09:38.119: E/AndroidRuntime(930):  at java.lang.reflect.Method.invoke(Method.java:511)
07-20 11:09:38.119: E/AndroidRuntime(930):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-20 11:09:38.119: E/AndroidRuntime(930):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-20 11:09:38.119: E/AndroidRuntime(930):  at dalvik.system.NativeStart.main(Native Method)
07-20 11:09:38.119: E/AndroidRuntime(930): Caused by: java.lang.NullPointerException
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
07-20 11:09:38.119: E/AndroidRuntime(930):  ... 11 more
cleroo
  • 1,145
  • 2
  • 11
  • 17

2 Answers2

1

It looks like you are using Thread.setDefaultUncaughtExceptionHandler(). You have set an application-level error handler, which is printing stacktrace to the log.

This is why your app runs on after throwing a Fatal Exception.

Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
1

I'm not sure what you are asking here. Your app is not working fine, your app throws a nullpointerexception. This is NOT fine.

Take a look at this line.

Caused by: java.lang.NullPointerException
07-20 11:09:38.119: E/AndroidRuntime(930):  at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)

Now I'm assuming your own classes/files are not named like this, and if you check for that initializeJavaContextClassLoader you find a lot of things. It looks like this is more of a "settings" or emulator thing then a code thing.

There are some other questions (you could call them duplicates even?) around:

THey all imply that this is something not code-specific, and it might have to do with your settings.

A clean etc is always advicable, but that doesn't seem to help with all. best you can do as far as I can see is to try and do a clean and build of your project.

Community
  • 1
  • 1
Nanne
  • 64,065
  • 16
  • 119
  • 163
  • The questions you mention are effectively duplicates. But the people don't seem to know the origin, and for some the app stills runs, and for others it crashes. – cleroo Jul 20 '12 at 09:46
  • I uninstalled the app, then did a clean. I don'tget these errors when launching for the first time, but still get these errors when launching after. – cleroo Jul 20 '12 at 09:53