【问题标题】:Google Play Services and Firebase conflictsGoogle Play 服务和 Firebase 冲突
【发布时间】:2018-05-20 09:31:32
【问题描述】:

我想同时使用 firebase 和 google play 服务依赖项。但这会引起一些冲突。当我添加播放服务依赖项时,firebase 依赖项不起作用。你知道如何同时使用这两个依赖项吗?谢谢。

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.android.gms:play-services:11.8.0'

【问题讨论】:

    标签: android firebase google-play-services


    【解决方案1】:

    改变这个:

    implementation 'com.google.android.gms:play-services:11.8.0'
    

    进入这个:

    implementation 'com.google.android.gms:play-services:12.0.1'
    

    【讨论】:

      【解决方案2】:

      15.0.0 之前的 com.google.android.gms:* 和 com.google.firebase:* 依赖项的版本必须是相同的版本。在 15.0.0 之后,情况不再如此。详情请见https://developers.google.com/android/guides/versioning

      应该注意,您也不应该再使用 com.google.android.gms:play-services 包罗万象的整体目标,因为这会将 所有 Google Play 服务和 Firebase 库包含在您的项目,不必要地膨胀您的应用程序,因为您不太可能需要使用所有目标。这种用法已经被劝阻了一段时间,实际上在 v15.0.0 (https://developers.google.com/android/guides/releases#april_12_2018_-_version_1500) 中被删除了

      【讨论】:

        猜你喜欢
        • 2019-04-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-15
        • 1970-01-01
        • 1970-01-01
        • 2017-09-01
        相关资源
        最近更新 更多