【发布时间】:2017-05-20 08:28:05
【问题描述】:
我使用 google games api 在我的 android 游戏中添加了排行榜。现在我想使用 Android Studio 的 Firebase 'Wizard' 添加横幅广告。它构建良好,但是当我尝试创建 apk 时,出现以下错误:
错误:将字节码转换为 dex 时出错: 原因:com.android.dex.DexException: 多个dex文件定义Lcom/google/android/gms/internal/zzqv;
使用向导后,我的 build.gradle 文件如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "xxx"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':BaseGameUtils')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.android.gms:play-services-games:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我尝试/阅读了与多个 dex 文件问题相关的所有内容,但对我没有任何帮助。有人对我有提示吗?我是否也必须将 Firebase 用于排行榜?没找到怎么...
感谢任何帮助/提示 彼得森
【问题讨论】:
-
我无法使用类似的 build.gradle 文件重现该问题。请发布您的顶级(项目)build.gradle。另外,您是否尝试过“清理”您的项目?
-
检查 BaseGameUtils 的 gradle 文件 - 我猜你有多个版本的 play-services-* 被包括在内。 BaseGameUtils 的价值不再有限,您可能只想将其中的几个静态方法直接复制到您的项目中。
标签: android firebase admob google-play-services google-play-games