Fatal Exception: java.lang.NoClassDefFoundError when calling static method in Android app

The NoClassDefFoundErrors 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:

  1. multiDexEnabled = true in the defaultConfig section of your app-level build.gradle

  2. compile 'com.android.support:multidex:1.0.0' in your project-level build.gradle

  3. Call MultiDex.install() in attachBaseContext() of your Application class.

More details on multidex can be found here.