I get this error when I Run->app for an Android application in Android Studio
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex file
Here is the correct solution solution, worked for me. Excluding the guava-jdk5 dependency module from each individual import is counterproductive (for me it didn't work because I had some internal dependencies coming from my backend on which my app depends, and this exposes the real issue with this approach).
The following solved the problem and is the recommended approach:
configurations {
all*.exclude group: 'com.google.guava', module: 'guava-jdk5'
}
Source: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html