【问题标题】:Gradle conflict when using admob 15.0.0 with the lastest support library使用带有最新支持库的 admob 15.0.0 时发生 Gradle 冲突
【发布时间】:2018-09-26 22:11:48
【问题描述】:

我正在使用“com.google.android.gms:play-services-ads:12.0.1”。 和 android 支持版本 27.1.1。

当我尝试将我的广告库升级到最新版本 (15.0.0) 时,我收到一条错误消息,提示我必须使用相同的版本规范。见下图。

有没有办法为 supportLibraries 和 play-services-ads 使用最新版本?

请注意,当我使用 play-services-ads 版本 12.0.1 时,此问题不存在

【问题讨论】:

    标签: android android-gradle-plugin android-support-library google-admob android-compatibility


    【解决方案1】:

    您可以尝试通过将支持库添加到依赖项块来覆盖冲突的支持库:

    implementation 'com.android.support:customtabs:27.1.1'
    

    【讨论】:

      【解决方案2】:

      将所有库更改为与您的情况有冲突的最低库,将您的一些库从 27.1.1 更改为 26.1.0。

      【讨论】:

        【解决方案3】:

        我恢复到 12.0.1

        implementation 'com.google.firebase:firebase-ads:12.0.1'
        

        在我看来,Google 需要解决这个问题。

        2018 年 5 月 4 日更新:

        Firebase-15.0.1 依赖于最新的 google 服务

        classpath 'com.google.gms:google-services:3.3.0'
        

        看到这个blog post

        但是,当我升级 google services 3.3.0 和 firebase-15.0.1 时,我遇到了其他无法解决的问题。使用 Google-Services 3.3.0,gradle 抱怨我导入的库模块:

        implementation project(':lib')
        

        Gradle 错误:

        More than one variant of project :lib matches the consumer attributes:
        
        - Configuration ':lib:debugApiElements' variant android-aidl:
          - Found artifactType 'android-aidl' but wasn't required.
          - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
          - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
          - Required 
        com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
          - Required org.gradle.usage 'java-api' and found compatible value 
        

        所以我的建议还是不要升级。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2023-03-06
          • 2018-03-09
          • 1970-01-01
          • 1970-01-01
          • 2021-02-24
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多