This issue occurs because of multiple dependency inclusion. You include the dependency that is already specified in the build.gradle file. For example:
compile 'com.google.android.gms:play-services:9.0.2' compile 'com.google.android.gms:play-services-identity:9.0.2'
the above dependency specification will create this problem, since game services include everything, including character identification, and thus, the same dependency is included several times.
The recommended option is only to include the dependencies that you really need. If you need the location of the game services and maps, include only these dependencies as:
compile 'com.google.android.gms:play-services-location:9.0.2' compile 'com.google.android.gms:play-services-maps:9.0.2'
Without including everything with 'com.google.android.gms: play-services: 9.0.2'.
In your particular case, I suspect that a conflict occurs between the google services of the top-level gradle file and play-services-identity and play-services-plus in the gradle application level file. Using only the services you need to enable multiple inclusion will solve your problem.
In general, you should not use "multiDexEnabled true" unless you have a strong and legitimate reason. Using this without knowing the actual problem means you are getting around the problem. You allow multiple overlapping dependencies giving a potential source of api conflicts and a larger apk size.
Reazul Hasan Russel Jun 12 '16 at 19:03 2016-06-12 19:03
source share