1

I am faced with this weird error. Whenever I start my application on my emulator, I get a message in the Emulator saying that Unfortunately,Search has stopped.

My LogCat also shows some error but after a few seconds, the application runs properly without any hassles.

But, every time I upload and install the application on the emulator I get this error.

I realise that it does not cause any trouble to the application as after the initial error, everything runs fine but still I would very much like to know the cause of such an error.

Here is what my LogCat displays.

07-08 13:47:38.262: E/AndroidRuntime(1931): FATAL EXCEPTION: main
07-08 13:47:38.262: E/AndroidRuntime(1931): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
07-08 13:47:38.262: E/AndroidRuntime(1931):     at   android.app.LoadedApk.makeApplication(LoadedApk.java:482)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at   android.app.ActivityThread.handleBindApplication(ActivityThread.java:3938)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.app.ActivityThread.access$1300(ActivityThread.java:123)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.os.Looper.loop(Looper.java:137)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.app.ActivityThread.main(ActivityThread.java:4424)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at java.lang.reflect.Method.invokeNative(Native Method)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at java.lang.reflect.Method.invoke(Method.java:511)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at dalvik.system.NativeStart.main(Native Method)
07-08 13:47:38.262: E/AndroidRuntime(1931): Caused by: java.lang.NullPointerException
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
07-08 13:47:38.262: E/AndroidRuntime(1931):     at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
07-08 13:47:38.262: E/AndroidRuntime(1931):     ... 11 more

Any idea what might be the cause ?

Swayam
  • 16,294
  • 14
  • 64
  • 102

2 Answers2

1
  1. Make sure you correctly declared the android:name attribute of your application tag in the AndroidManifest.xml file.

  2. See this answer here for an explanation on the Unable to instantiate application android.app.Application logcat error.

Community
  • 1
  • 1
Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
0

Make an entry in androidManifest.xml with the application name

<application
        android:name=<name of the class that extends Application>
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
ndeverge
  • 21,378
  • 4
  • 56
  • 85
Badrinath
  • 325
  • 1
  • 7
  • 25