首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >多个dex文件定义了Lcom/google/android/gms/internal/zzau

多个dex文件定义了Lcom/google/android/gms/internal/zzau
EN

Stack Overflow用户
提问于 2015-07-05 03:11:03
回答 10查看 40.1K关注 0票数 40

当我运行我的应用程序时,我得到了错误com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzau;

app.gradle

代码语言:javascript
复制
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

代码语言:javascript
复制
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'
}

我该如何解决这个问题?我猜这个错误是因为我在模块和应用程序中都使用了google play服务。但是版本是不同的。这会引起问题吗?

EN

回答 10

Stack Overflow用户

回答已采纳

发布于 2015-07-16 17:11:17

我也有类似的问题,你的问题帮助我解决了我的问题,可能也会帮助你解决你的问题。问题是你已经定义了:

代码语言:javascript
复制
dependencies {
...
  compile 'com.google.android.gms:play-services-cast:7.5.0'
}

代码语言:javascript
复制
dependencies {
...
  compile 'com.google.android.gms:play-services:7.0.+'
...
}

从google services 7.5.0开始,如果你使用play服务中的单个模块,你就不能同时使用整个play服务作为依赖项。解决方案是只选择您需要的那些服务,而不是整个包,例如:

而不是

代码语言:javascript
复制
dependencies {
...
  compile 'com.google.android.gms:play-services:7.0.+'
...
}

使用

代码语言:javascript
复制
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.+'
...
}

我也不确定,但在两个gradle配置中使用相同版本的google服务可能是个好主意。

票数 30
EN

Stack Overflow用户

发布于 2016-07-28 13:07:07

在使用phonegap/cordova进行构建后,我遇到了类似的问题: com.android.dex.DexException:多个dex文件定义了Lcom/google/android/gms/internal/zzsk;

我通过编辑build.gradle(模块安卓)修复了它,因为我有两个库,它们应该有完全相同的版本,但版本号不同(在我的例子中是8.4.0和9.2.1 )

代码语言:javascript
复制
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
....
}
票数 16
EN

Stack Overflow用户

发布于 2018-03-14 04:47:16

如果这种情况发生在react-native-device-info上,则只能从以下位置更改:

代码语言:javascript
复制
compile(project(':react-native-device-info'))

代码语言:javascript
复制
compile(project(':react-native-device-info')) {
  exclude group: 'com.google.android.gms'
}

如下所述:https://github.com/rebeccahughes/react-native-device-info/blob/81b0c20fab8a10ccf0341dbd6710d7a5915b06a6/README.md#troubleshooting

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31224276

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档