I get the error com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzau;
when i run my app The gradle files are
app.gradle
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:support-v4:21.0.3' compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.android.support:recyclerview-v7:21.0.0' compile 'com.android.support:cardview-v7:21.0.0' compile 'com.google.android.gms:play-services:7.0.+' compile 'com.android.support:mediarouter-v7:21.0.3' compile 'com.squareup:otto:1.3.5' compile 'com.squareup.picasso:picasso:2.3.4' compile 'com.squareup.okhttp:okhttp:2.2.0' compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.github.ksoichiro:android-observablescrollview:1.4.0' compile 'com.astuetz:pagerslidingtabstrip:1.0.1' compile 'com.facebook.android:facebook-android-sdk:4.1.0' compile 'com.parse.bolts:bolts-android:1.+' compile 'com.edmodo:rangebar:1.0.0' compile 'com.melnykov:floatingactionbutton:1.3.0' compile project(':library_viewpager') compile project(':androidHorizontalListView') compile project(':CastCompanionLibrary') compile project(':mobihelp_sdk_android_v1.4') compile fileTree(include: 'Parse-*.jar', dir: 'libs') compile files('libs/Parse-1.9.2.jar') compile files('libs/GoogleConversionTrackingSdk-2.2.2.jar') }
CastCompanionLibrary
dependencies { compile 'com.android.support:appcompat-v7:22.+' compile 'com.android.support:mediarouter-v7:22.+' compile 'com.google.android.gms:play-services-cast:7.5.0' }
How do i fix this? i guess the error occurs because i use google play services in both the module and the app. but the versions are different. is that causing an issue?
I had similar problem and your question helped me solve mine and probably will help you solve yours. Problem is that you have defined:
dependencies { ... compile 'com.google.android.gms:play-services-cast:7.5.0' }
and
dependencies { ... compile 'com.google.android.gms:play-services:7.0.+' ... }
Since google services 7.5.0, if you're using single modules from play services you can't use whole play services as dependency simultaneously. Solution is to select only those services that you need instead of whole package e.g.:
instead of
dependencies { ... compile 'com.google.android.gms:play-services:7.0.+' ... }
use
dependencies { ... compile 'com.google.android.gms:play-services-maps:7.0.+' compile 'com.google.android.gms:play-services-location:7.0.+' compile 'com.google.android.gms:play-services-gcm:7.0.+' ... }
Also I'm not sure but probably it would be good idea to use the same version of google services in both gradle configs.
I had a similar problem after building using phonegap/cordova: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzsk;
I fixed it by editing build.gradle(module Android), as I had 2 libraries that should have the exact same version with different version numbers (8.4.0 and 9.2.1 in my case)
dependencies{ .... //make sure are both same version (8.4.0 or 9.2.1 in my case) compile 'com.google.android.gms:play-services-gcm:9.2.1' // this is the one I changed: compile 'com.google.android.gms:play-services-location:8.4.0' compile 'com.google.android.gms:play-services-location:9.2.1' // it was 8.4.0 .... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With