Fatal Exception: java.lang.NoClassDefFoundError when calling static method in Android app
The NoClassDefFoundError
s were happening because multidex was only partially implemented in this app - for some reason, this works fine on Android 5/6 but on Android 4.x it makes your app crash with NoClassDefFoundError
in random places. It seems to me like this situation should be detected by Android Studio and you should be warned you've improperly implemented multidex support.
To fix it, make sure the following is true for your project:
multiDexEnabled = true
in thedefaultConfig
section of your app-level build.gradlecompile 'com.android.support:multidex:1.0.0'
in your project-level build.gradleCall
MultiDex.install()
inattachBaseContext()
of your Application class.
More details on multidex can be found here.