I'm running the new stable release of Android Studio ver 2.0. When I disable instant run my app runs fine, but when I turn it on it gives me this error:
Caused by: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to com.my.app.CustomApplication
CustomApplication is an Application class that I get through a context. But I can't seem to get it. When instant run is on, my class is cast as BootstrapApplication then fails.
My app is a floating service like FB chatheads.
I have the latest gradle build:
classpath 'com.android.tools.build:gradle:2.0.0'
Other answers here say that instant Run tries to do hot swapping of code; this causes the application class to be moved.
So how can I get around this?