com.android.dex.DexException: Multiple dex files define Lcom/example/lib/Class;
This error occurs because the app, when packaging, finds two
.dex files that define the same set of methods.
Usually this happens because the app has accidentally acquired 2 separate dependencies on the same library.
For instance, say you have a project, and you want to rely on two libraries:
B, which each have their own dependencies. If library
B already has a dependency on library
A, this error will be thrown if library
A is added to the project by itself. Compiling library
B already gave the set of code from
A, so when the compiler goes to bundle library
A, it finds library
A's methods already packaged.
To resolve, make sure that none of your dependencies could accidentally be added twice in such a manner