Multiple dex files define Lcom/google/android/gms/internal/zzau

前端 未结 14 1214
[愿得一人]
[愿得一人] 2020-11-29 10:55

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

ap

14条回答
  •  自闭症患者
    2020-11-29 11:39

    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.

提交回复
热议问题