If I run gradle assembleDebug from the command line, I am suddenly getting this error:
gradle assembleDebug
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.util.DexEx
In Android Studio, go to your build.gradle (check both project and modules build.gradle files) and search for duplicate dependencies.
Delete those your project does not need.