You need to change the application in the manifest to the multidex application, or override attachBaseContext() in your custom application class to call MutiDex.install(this) after the super.attachBaseContext(base); see more info here

Case 2 : Duplicate entries of same dependencies

Also, suppose you are adding a lot of dependencies to your project. Now each of these dependencies may internally use other dependencies as well. In this way, there is a possibility of same dependencies to get added up more than once.

In order to check which dependencies are being internally used by other dependencies you could print the gradle dependencies tree like shown below.

From this structure we can easily identify which all dependencies are being internally used by other dependencies

Suppose you have a facebook sdk dependency which use support-v4 internally. But we already have a different version of support-v4 already added in dependencies list. When we try to compile the project, we may see that gradle sync has failed due to finished with non-zero exit value 2. The fix for this issue will be to exclude the internally used dependency from facebook sdk like shown below