Cordova Error on Build Only for Android: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;

Had the same problem, adding the following lines to the build.gradle file located in platforms/android did it for me.

configurations {
   all*.exclude group: 'com.android.support', module: 'support-v4'
}

I copied it after the line:

apply plugin: 'android'

Hope this helps.


This is almost definitely because of conflicting plugins. The way I solved it (I hope you're sitting comfortably) was to remove every single plugin, then add each of them one by one and try building. As far as I can see, that's the only real way to diagnose these.

Usually it's dependencies on some sort of Google library (play services or location), so I'd say the most likely culprits are plugins involved in location or push notifications.