我使用 google games api 将排行榜添加到我的 android 游戏中。现在我想使用 Android Studio 的 Firebase“向导”添加横幅广告。它构建良好,但是当我尝试创建 apk 时,出现以下错误:
Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define 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 用于排行榜?找不到如何...
感谢任何帮助/提示 佩特森
最佳答案
感谢 Clayton Wilkinson 的评论,我可以解决我的问题。 问题是 BaseGameUtils 仍在使用/引用旧版本的播放服务。添加了正确的版本,现在可以使用了。我想我会在下一个项目中省略 BaseGameUtils。
非常感谢
关于android - 将 Google Play 游戏与 Firebase 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41491074/