title: Unable to instantiate application java.lang.ClassNotFoundException. Didn't find class "Application" on path: DexPathList
body: <p>After I run <code>gradle clean</code> and build and upload apk on device my app crash on start with following exception. I use Android Studio 1.3.1. </p>
  
  <pre><code>  java.lang.RuntimeException: Unable to instantiate application my.package.MyApplication: java.lang.ClassNotFoundException: Didn't find class "my.package.MyApp" on path: DexPathList[[zip file "/data/app/com.unated-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
          at android.app.LoadedApk.makeApplication(LoadedApk.java:569)
          at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4589)
          at android.app.ActivityThread.access$1500(ActivityThread.java:149)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:211)
          at android.app.ActivityThread.main(ActivityThread.java:5317)
          at java.lang.reflect.Method.invoke(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:372)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
   Caused by: java.lang.ClassNotFoundException: Didn't find class "com.unated.ProductionApp" on path: DexPathList[[zip file "/data/app/com.unated-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
          at android.app.Instrumentation.newApplication(Instrumentation.java:979)
   Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  </code></pre>
  
  <p>I have 2 flavors: production and staging. And I have two different <code>Application</code> classes for each flavor.
  I read <a href="https://stackoverflow.com/questions/10150899/runtimeexception-unable-to-instantiate-application">RuntimeException: Unable to instantiate application</a> but killing app from recent list does not work.
  If I change flavor then some times app starts to work. And sometimes if I change flavor back it starts to work (but often not). I can not figure out how to make it work. Very annoying thing, please help!</p>