I have a working project in Eclipse. Very often when I try Eclipse' Run command, I see some errors in logcat. Apparently the APK does not get installed or something. Eclipse/ADB tries again and second time around it always works as expected. This error does not seem to have any operational impact, but still I'm curious as to why it's happening.
- Eclipse: Version: 3.7.2, Build id: M20120208-0800
- Android SDK: 4.0
- Target: Samsung Tab, Samsung S2, Emulator
Here is the logcat.
11-28 17:08:59.097: E/AndroidRuntime(14086): FATAL EXCEPTION: main
11-28 17:08:59.097: E/AndroidRuntime(14086): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4198)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread.access$1300(ActivityThread.java:140)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1288)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.os.Handler.dispatchMessage(Handler.java:99)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.os.Looper.loop(Looper.java:137)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.ActivityThread.main(ActivityThread.java:4895)
11-28 17:08:59.097: E/AndroidRuntime(14086): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 17:08:59.097: E/AndroidRuntime(14086): at java.lang.reflect.Method.invoke(Method.java:511)
11-28 17:08:59.097: E/AndroidRuntime(14086): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
11-28 17:08:59.097: E/AndroidRuntime(14086): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
11-28 17:08:59.097: E/AndroidRuntime(14086): at dalvik.system.NativeStart.main(Native Method)
11-28 17:08:59.097: E/AndroidRuntime(14086): Caused by: java.lang.NullPointerException
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
11-28 17:08:59.097: E/AndroidRuntime(14086): at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
11-28 17:08:59.097: E/AndroidRuntime(14086): ... 11 more
11-28 17:09:07.815: D/dalvikvm(14166): GC_FOR_ALLOC freed 54K, 9% free 7431K/8131K, paused 30ms, total 30ms
11-28 17:09:07.815: I/dalvikvm-heap(14166): Grow heap (frag case) to 9.173MB for 1463056-byte allocation
11-28 17:09:07.839: D/dalvikvm(14166): GC_CONCURRENT freed <1K, 8% free 8859K/9607K, paused 2ms+2ms, total 20ms
11-28 17:09:07.995: D/MainActivity(14166): onCreate()