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 app-debug.apk
from /app/build/output/apk
and forward it to the testing dept via Beta (by Fabric).
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.
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.
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?
I'm using:
- Android Studio V2.1.3
- Min. SDK version 15
- Target SDK version 23
- Compiled SDK version 23
- Build tools version 24.0.2
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?
Does anyone know about this issue?
Update: The build that crashes on Android K works fine on Android L and above.
Update: I was able to get the Logcat:
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)
UPDATE 7/12/2016: I've tried adding multi-dex support and it doesn't solve the issue. The logcat gives the same logs.