Edit:
Please note the following issue does not occur when using Proguard, or in debug. Only issue with R8 in release
Step to reproduce:
Create a new blank Xamarin.Android application
Without making any change, simply run in debug make sure the project compile and run
Enable r8 and multi-dex:
Create release APK
When running the release APK, it will crash on startup with error:
2021-06-04 11:35:01.818 20194-20194/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.companyname.app1, PID: 20194
java.lang.RuntimeException: Unable to instantiate application androidx.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "androidx.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/lib/x86, /data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1226)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6431)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/lib/x86, /data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at android.app.Instrumentation.newApplication(Instrumentation.java:1148)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1218)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6431)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I've played around with Linking options, but they all result in the same result.
A simple project can be found here:
https://drive.google.com/file/d/1oihKvJnRjxGiOaa2JS0FYKlQYI615p91/view?usp=sharing
Any help is highly appreciated!
When enabling multidex the correct multidex library (either com.android.support:multidex:1.0.3 or androidx.multidex:multidex:2.0.1) has to be used. As class androidx.multidex.MultiDexApplication is missing use androidx.multidex:multidex:2.0.1. Could be that the project template in Xamarin defailts to com.android.support:multidex:1.0.3.
See Multidex support prior to Android 5.0 for details.
Related
I am currently stuck with integrating the new firebase perf with my current android app. Everything works fine when I disable it i.e., firebasePerformanceInstrumentationEnabled = false. But I keep getting the below error when I enable it i.e., set it's value to true`.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.testflight.app, PID: 22011
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/neovisionaries/ws/client/D;
at com.neovisionaries.ws.client.WebSocketFactory.<init>(SourceFile:2)
at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.e(SourceFile:1)
at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.onEncodingComplete(SourceFile:3)
at it.slyce.sdk.internal.BitmapEncodingTask.a(SourceFile:4)
at it.slyce.sdk.internal.BitmapEncodingTask.onPostExecute(SourceFile:1)
at android.os.AsyncTask.finish(AsyncTask.java:755)
at android.os.AsyncTask.access$900(AsyncTask.java:192)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7811)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.neovisionaries.ws.client.D" on path: DexPathList[[zip file "/data/app/com.ashleyfurniturehomestore.ecomm-X1w1G27mqcSRlwfLujt7mQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.testflight.app-X1w1G27mqcSRlwfLujt7mQ==/lib/arm64, /data/app/com.testflight.app-X1w1G27mqcSRlwfLujt7mQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.neovisionaries.ws.client.WebSocketFactory.<init>(SourceFile:2)
at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.e(SourceFile:1)
at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.onEncodingComplete(SourceFile:3)
at it.slyce.sdk.internal.BitmapEncodingTask.a(SourceFile:4)
at it.slyce.sdk.internal.BitmapEncodingTask.onPostExecute(SourceFile:1)
at android.os.AsyncTask.finish(AsyncTask.java:755)
at android.os.AsyncTask.access$900(AsyncTask.java:192)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7811)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
How can I solve this?
Try to run with proguard disabled. If it works, you need to edit your ProguardRules.pro file to exclude Firebase libraries.
Im trying to implement adMob but my app isn't launching and providing the following error:
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAdsInitProvider" on path: DexPathList[[zip file "/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/lib/arm64, /system/lib64]]
at android.app.ActivityThread.installProvider(ActivityThread.java:7369)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6909)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6826)
at android.app.ActivityThread.access$1400(ActivityThread.java:267)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1981)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAdsInitProvider" on path: DexPathList[[zip file "/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/lib/arm64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147)
at android.app.ActivityThread.installProvider(ActivityThread.java:7353)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6909)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6826)
at android.app.ActivityThread.access$1400(ActivityThread.java:267)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1981)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/com.aaron.derrystudios.wordresolver-mOF2EngPcA5nT8dd27zx5g==/base.apk': Bad encoded_value method type size 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:365)
at dalvik.system.DexFile.<init>(DexFile.java:107)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:403)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:126)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:101)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:892)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:991)
at android.app.LoadedApk.getResources(LoadedApk.java:1248)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2614)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2606)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6724)
... 8 more
I searched for this problem and all of the solutions, like this, are saying you now need to provide the App ID supplied from adMob in the manifest. I have tripled checked this and the correct app ID is provided in the manifest under meta-data tags as you can see here:
I've been following this official guide and went over it twice, but I am still getting this error.
I am also using a dedicated test ad unit ID for Android banners, so I don't think that is the problem.
What else could be causing this?
I got a similar error and this solved it.
In biuld.gradle (Module)
android {
...
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
While running apk from android studio via adb it is working/running properly. but when i am giving that debug apk to my client it is crashing. but when i am giving signed apk it is working fine.
The debug apk installed successfully but when it going to run then it get "class not found error".
09-19 20:05:12.065 29019-29019/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.volansys.homebridge, PID: 29019
java.lang.RuntimeException: Unable to instantiate application com.volansys.homebridge.HomeBridgeApplication: java.lang.ClassNotFoundException: Didn't find class "com.volansys.homebridge.HomeBridgeApplication" on path: DexPathList[[zip file "/data/app/com.volansys.homebridge-2/base.apk"],nativeLibraryDirectories=[/data/app/com.volansys.homebridge-2/lib/arm, /system/lib, /vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.volansys.homebridge.HomeBridgeApplication" on path: DexPathList[[zip file "/data/app/com.volansys.homebridge-2/base.apk"],nativeLibraryDirectories=[/data/app/com.volansys.homebridge-2/lib/arm, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newApplication(Instrumentation.java:1014)
at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
i also changed the manifest file and gave the whole path to the application class like
android:name="package_name.HomeBridgeApplication"
When i going to ctrl+click on this class it can navigate to this class. it means path is proper so why i am getting class not found error ?
can anyone help me ?
Thanks in Advance.
I am working on one application that have only one screen barcode scanning and I am achieve this with zxing Library. But my problem is if I am install app with android studio it is working fine but if I share this apk from output folder with Bluetooth, Email, Xender, etc.. Application is install but when I open the app it will crash and Exception is NoClassFoundException.
Here is Logcat:
FATAL EXCEPTION: main
Process: com.jenex.cartracking, PID: 31223
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.jenex.cartracking/com.jenex.cartracking.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.jenex.cartracking.MainActivity" on path: DexPathList[[zip file "/data/app/com.jenex.cartracking-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3029)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3300)
at android.app.ActivityThread.access$1000(ActivityThread.java:211)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6946)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.jenex.cartracking.MainActivity" on path: DexPathList[[zip file "/data/app/com.jenex.cartracking-1/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.newActivity(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3019)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3300)
at android.app.ActivityThread.access$1000(ActivityThread.java:211)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6946)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Suppressed: java.lang.ClassNotFoundException: com.jenex.cartracking.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
You have to clean build before share the app and make a debug build.
Follow this simple steps,
Goto Build -> Clean Project
Goto Build -> Build Apk
This will generate build Apk. Share this Apk.
Hope this helps.
It seems like I have the same problem. Such an exception happens now with any project, even with empty and clean just created. I used to share myproject_debug.apk with testers, but now it crashes on start up. Maybe it started after some update of Android Studio or platform-tools, I'm not sure.
So, I found some work around that work for me
Before copy project-debug.apk from output folder:
go to menu in Android Studio and open menu 'Build'
click 'Build APK'
After successful build I copy myproject-debug.apk from output folder and it works well.
I am facing an issue with my app:
If I deactivate within Android Studio Instant Run, my app crashes upon startup with the stacktrace:
12-29 13:36:37.876 4549-4549/com.mycoolapp.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycoolapp.debug, PID: 4549
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mycoolapp.debug/com.myapp.SplashScreenActivity}: java.lang.ClassNotFoundException: Didn't find class "com.myapp.SplashScreenActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.mycoolapp.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycoolapp.debug-2/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2216)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
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:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.SplashScreenActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.mycoolapp.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycoolapp.debug-2/lib/arm, /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.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
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:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Suppressed: java.lang.NoClassDefFoundError: com.myapp.SplashScreenActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.myapp.SplashScreenActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
As far as I have researched this belongs to multidex:
https://developer.android.com/studio/build/multidex.html
Even if I add the multiDexEnabled property to my gradle config the app crashes. Only if I enable InstantRun (which enables multidex in background), the app runs...
If I create an apk the installation works, but the app crashes on startup with the same error.
Since I have as minSDK API Level 21, there should be no other change except of the multiDexEnabled property necessary, right?
So last but not least my answer:
All my configuration for multidex was correct... I don't know why, but after a complete OS restart everything works fine now... :)
Just create new phone on AVD and try to install app on that phone. Hope it will work.
The accepted answer was only a temporary fix for me, after altering code and a few builds the error came back.
After alot of trial and error the real problem was the jdk location my project was using, instead of using the embedded jdk in android studio i was using an installed version from oracle. After going to File > Project Structure > SDK Location and checking Use embedded JDK the problem was fixed for good.
Check if your classpath
'com.android.tools.build:gradle:3.1.0-alpha05'
is up-to-date, had same problem and solved it with a full update.