The number of method references in a .dex file cannot exceed 64K

My V3 app code worked fine when testing on a device via “ionic cordova run android”. But all of a sudden, in doing a build, I’m getting the error

The number of method references in a .dex file cannot exceed 64K.

and I can’t do much at this point. Been googling for answers but not much luck.

Any idea how to fix this?

In case someone else experiences this, I fixed it by adding

       multiDexEnabled true

to the android {defaultConfig{} section of build.gradle