title: Debug APK distributed for testing crashes when built on Android L and installed on Android K
body: <p>So I'm facing this issue for some time now. While debugging I'm using my device which runs Android 5.1 (L). When I'm done, I pick up the <code>app-debug.apk</code> from <code>/app/build/output/apk</code> and forward it to the testing dept via Beta (by Fabric).</p>
  
  <p>So on testers side, when installed on a device running Android 4.4 (K), the app crashes when opened. This is not an issue with Fabric because the same thing happens with other channels like slack, email, etc.</p>
  
  <p>If I build the app again on an emulator running Android K and send the apk, it will run fine on testers devices. Yes the app crashes on multiple devices running Android 4.4 though.</p>
  
  <p>I could find nothing related to this on SO, so thought to put this up. Is this a known issue with Android Studio or am i missing something?</p>
  
  <p>I'm using:</p>
  
  <ul>
  <li>Android Studio V2.1.3</li>
  <li>Min. SDK version 15</li>
  <li>Target SDK version 23</li>
  <li>Compiled SDK version 23</li>
  <li>Build tools version 24.0.2</li>
  </ul>
  
  <p>If this is not a bug, does it mean we have to generate signed apk on a lower Android version so that it will run on all devices?</p>
  
  <p>Does anyone know about this issue?</p>
  
  <p><strong>Update:</strong> The build that crashes on Android K works fine on Android L and above.</p>
  
  <p><strong>Update:</strong> I was able to get the Logcat:</p>
  
  <pre><code>FATAL EXCEPTION: mainProcess: com.myapp.qa, PID: 3570 java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/com.myapp.qa-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp.qa-2, /vendor/lib, /system/lib]]
      at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317)
      at android.app.ActivityThread.access$1500(ActivityThread.java:135)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:136)
      at android.app.ActivityThread.main(ActivityThread.java:5017)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:515)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
      at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/com.myapp.qa-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp.qa-2, /vendor/lib, /system/lib]]
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
      at android.app.Instrumentation.newApplication(Instrumentation.java:975)
      at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317) 
      at android.app.ActivityThread.access$1500(ActivityThread.java:135) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
      at android.os.Handler.dispatchMessage(Handler.java:102) 
      at android.os.Looper.loop(Looper.java:136) 
      at android.app.ActivityThread.main(ActivityThread.java:5017) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:515) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
      at dalvik.system.NativeStart.main(Native Method) 
  </code></pre>
  
  <p><strong>UPDATE 7/12/2016:</strong> I've tried adding multi-dex support and it doesn't solve the issue. The logcat gives the same logs.</p>