2012-10-01

Exception appears when run Android Application from Eclipse


I got this exception when everytime I re-run my App from Eclipse.
E/AndroidRuntime(1020): FATAL EXCEPTION: main
E/AndroidRuntime(1020): java.lang.RuntimeException: Unable to instantiate application   my.example.Application: java.lang.NullPointerException
E/AndroidRuntime(1020):     at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
E/AndroidRuntime(1020):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3938)
E/AndroidRuntime(1020):     at android.app.ActivityThread.access$1300(ActivityThread.java:123)
E/AndroidRuntime(1020):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
E/AndroidRuntime(1020):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(1020):     at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(1020):     at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(1020):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(1020):     at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(1020):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(1020):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(1020):     at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(1020): Caused by: java.lang.NullPointerException
E/AndroidRuntime(1020):     at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
E/AndroidRuntime(1020):     at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
E/AndroidRuntime(1020):     at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
E/AndroidRuntime(1020):     ... 11 more

This exception is related with Android Framework, and only happened on Android 4.0

"when dalvik re-install .apk file and trying to reuse or recycle the previous opened activity/view from the same package (if you haven't closed the previous installed app yet). It has nothing to do with your app, moreover, it is very unlikely that your app will get freezed or crashed cause by this verbose error message on end user's device."
Please refer to the discuss:
http://stackoverflow.com/questions/10150899/runtimeexception-unable-to-instantiate-application
http://stackoverflow.com/questions/9746116/exception-when-i-run-my-application-from-eclipse

Maybe you can ignore this crash, your App will not crash or freezed because of that exception.

Android issue Tracker:
http://code.google.com/p/android/issues/detail?id=25869&can=1&q=LoadedApk.makeApplication&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

No comments: