This secret recipe makes your apps work on pre-lollipop devices. You may be developing on Android 5.0+ and you would not realize that your app is breaking at the start for other versions of Android which are lower than Lollipop.

Trick is that Apps with lots of dependencies (well they don’t have to a lot but if you have google play services as dependency which is needed for admob, you should apply this method) need multidex enabled for building. Otherwise they work fine on L devices and fails at the startup for pre-L devices.

[Android Twitter Crashes with Appcompat v7 on API 19 and lower]

Building Apps with Over 65K Methods

Why am I still getting java.lang.NoClassDefFoundError:$attr?

Don’t do this:

<application ... android:theme="@style/Theme.AppCompat" >

Do This

  1. Change AndroidManifest.xml


<application ... android:name=""> ... </application>


  1. Add this to the build.gradle

defaultConfig { applicationId "net.guldum.caps" minSdkVersion 16 targetSdkVersion 22 versionCode 9 versionName "1.8" multiDexEnabled true }

dependencies { compile '' }