NoClassDefFoundError with Android Studio on Android 4

I was incompletely implementing MultiDex support, so some of my classes weren’t in the proper dex file. To fix it, you have to do more than just set multiDexEnabled = true in your defaultConfig block. You also have to:

  1. Include compile 'com.android.support:multidex:1.0.1' in your dependencies
  2. Have your Application class extend MultiDexApplication instead of just Application. Alternatively, you can call MultiDex.install() in attachBaseContext() of your application.

See https://developer.android.com/tools/building/multidex.html for more details.

Leave a Comment