0

It gives exception whenever app is installed and launched . And somtime it suddenly through exception and my gets crashed

java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.NullPointerException at android.app.LoadedApk.makeApplication(LoadedApk.java:501) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4255) at android.app.ActivityThread.access$1400(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:174) at android.app.ActivityThread.main(ActivityThread.java:4952) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377) at android.app.LoadedApk.getClassLoader(LoadedApk.java:320) at android.app.LoadedApk.makeApplication(LoadedApk.java:493) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4255)  at android.app.ActivityThread.access$1400(ActivityThread.java:140)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:174)  at android.app.ActivityThread.main(ActivityThread.java:4952)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)  at dalvik.system.NativeStart.main(Native Method) 

Why this exception is thrown ? and how to handle it .I am new to android world

Yaseen Ahmad
  • 1,807
  • 5
  • 25
  • 43
FaisalAhmed
  • 3,469
  • 7
  • 46
  • 76

1 Answers1

0

Disable the Instant Run option in Android Studio.

Instant Run tries to do hot swapping of your code; this causes the application class to be moved.

To disable Instant Run Go to File --> Settings--> Build,Execution,Deployment -->Instant Run ---> uncheck "Enable instant run"

Akshay Panchal
  • 695
  • 5
  • 15
  • But instant runs is an important feature of android studio and it is really help full . Disabling it will really slow down my speed of practice and testing – FaisalAhmed Aug 10 '16 at 06:30
  • 1
    @FaisalAhmed Agree. However, in its current state its really buggy. (in one of my apps it jumbled up the string resources while testing!. At other instances, it messes with Alert Dialogs, etc.) – Shaishav Aug 10 '16 at 06:53
  • Yes instant run is buggy as its in earlier stage so you should try disabling it to solve your problem – Akshay Panchal Aug 10 '16 at 06:54