I am currently implementing my first Android app. Debugging and developing goes usually fine but sometimes I have problem when doing some changes in my code and then starting the app again from Eclipse environment (to virtual device).
As far as I understand it, new start terminates the currently running version of my app in the emulator, that's fine - but is this some correct termination? Is some event raised in my app which I should handle?
Why am I asking? My problem is that for most of the Activities being currently active in the emulator my app terminates (it's gone) correctly and new version starts fine. But for about 2 of my Activities when they are active and I "restart" my app from Eclipse I can see for a few seconds message box "Unfortunately APP has stopped" and that gives me an idea that these Activities have probably to do something in their destructor, uninitialize something or whatever because termination causes some kind of crash. How to detect this, how to debug this? When I start the app again, the old version debugger is disconnected so it's not helping. All I can see is logcat exception call stack info but it's not helping me too much:
As far as I understand it, new start terminates the currently running version of my app in the emulator, that's fine - but is this some correct termination? Is some event raised in my app which I should handle?
Why am I asking? My problem is that for most of the Activities being currently active in the emulator my app terminates (it's gone) correctly and new version starts fine. But for about 2 of my Activities when they are active and I "restart" my app from Eclipse I can see for a few seconds message box "Unfortunately APP has stopped" and that gives me an idea that these Activities have probably to do something in their destructor, uninitialize something or whatever because termination causes some kind of crash. How to detect this, how to debug this? When I start the app again, the old version debugger is disconnected so it's not helping. All I can see is logcat exception call stack info but it's not helping me too much:
01-19 11:19:16.352: E/AndroidRuntime(1424): FATAL EXCEPTION: main 01-19 11:19:16.352: E/AndroidRuntime(1424): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.makeApplication(LoadedApk.java:504) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread.access$1300(ActivityThread.java:141) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.os.Looper.loop(Looper.java:137) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread.main(ActivityThread.java:5039) 01-19 11:19:16.352: E/AndroidRuntime(1424): at java.lang.reflect.Method.invokeNative(Native Method) 01-19 11:19:16.352: E/AndroidRuntime(1424): at java.lang.reflect.Method.invoke(Method.java:511) 01-19 11:19:16.352: E/AndroidRuntime(1424): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 01-19 11:19:16.352: E/AndroidRuntime(1424): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 01-19 11:19:16.352: E/AndroidRuntime(1424): at dalvik.system.NativeStart.main(Native Method) 01-19 11:19:16.352: E/AndroidRuntime(1424): Caused by: java.lang.NullPointerException 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:379) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.getClassLoader(LoadedApk.java:322) 01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.makeApplication(LoadedApk.java:496) 01-19 11:19:16.352: E/AndroidRuntime(1424): ... 11 more
0 comments:
Post a Comment