I had the same exception - but only while running in debug mode, this is how I solved the problem (after 3 whole days): in the build.gradle i had : "multiDexEnabled true" set in the defaultConfig section.
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 15
targetSdkVersion 28
versionCode 5123
versionName "5123"
// Enabling multidex support.
multiDexEnabled true
}
but apparently this wasn't enough. but when i changed:
public class MyAppClass extends Application
to:
public class MyAppClass extends MultiDexApplication
this solved it. hope this will help someone