将Google Play游戏与Firebase混合使用 [英] Mixing Google Play games with Firebase

查看:395
本文介绍了将Google Play游戏与Firebase混合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用谷歌游戏api将排行榜添加到了我的Android游戏中。现在我想使用Android Studio的Firebase向导添加横幅广告。它构建的很好,但是当我尝试创建一个apk时,出现以下错误:

lockquote

错误:将字节码转换为dex时出错:
原因:com.android.dex.DexException:多个dex文件定义Lcom / google / android / gms / internal / zzqv;



<使用向导后,我的build.gradle文件如下所示:

  apply plugin:'com.android.application' 
$ b b android {
compileSdkVersion 22
buildToolsVersion22.0.1
defaultConfig {
applicationIdxxx
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName1.0
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-r ules.pro'
}
}
}

依赖关系{

编译fileTree(dir:'libs',include:[' (':BaseGameUtils')

androidTestCompile('com.android.support.test.espresso:espresso-core :2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
})

compile'c​​om.google.android .gms:play-services-games:10.0.1'
compile'c​​om.google.firebase:firebase-ads:10.0.1'

testCompile'junit:junit:4.12'



应用插件:'com.google.gms.google-services'

我试着读过所有与多个dex文件问题有关的东西,但没有为我工作。任何人都有对我的暗示?我是否也必须将Firebase用于排行榜?无法找到...



感谢您的任何帮助/提示
pettersson

解决方案

感谢Clayton Wilkinson的评论,我可以解决我的问题。
问题在于BaseGameUtils仍在使用/引用较旧版本的播放服务。添加了正确的版本,现在它可以工作。猜猜我会为我的下一个项目省略BaseGameUtils。



非常感谢


I added leaderboards to my android game using google games api. Now I wanted to add banner ads using the Firebase 'Wizard' of Android Studio. It builds fine, but when I try to create an apk, I get the following error:

Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzqv;

After using the wizard, my build.gradle file looks like this:

    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'

I tried/read all things related to the multiple dex files problem, but nothing worked for me. Anyone has a hint for me? Do I have to use Firebase for leaderboards as well? Couldn't find how...

Thanks for any help/hints pettersson

解决方案

thanks to Clayton Wilkinson's comment, I could fix my problem. The problem was that BaseGameUtils was still using/referencing an older version of play-services. Added the correct version, and it works now. Guess I will omit BaseGameUtils for my next project.

Thanks a lot

这篇关于将Google Play游戏与Firebase混合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆