【问题标题】:app compat dependency got error when i added google play dependency当我添加 google play 依赖项时,app compat 依赖项出错
【发布时间】:2017-04-13 17:55:17
【问题描述】:

我在 android studio 中使用 firebase 构建应用程序。当我添加 google play 依赖项时,我的应用程序兼容依赖项出现错误。

这是我的毕业典礼

compile 'com.android.support:appcompat-v7:24.2.1'


compile 'com.android.support:cardview-v7:24.2.1'


 compile 'com.android.support:recyclerview-v7:24.2.1'


compile 'com.android.support. :constraint-layout:1.0.0-alpha9'


 compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-storage:10.0.1'


 compile 'com.google.firebase:firebase-auth:10.0.1'


compile 'com.google.android.gms:play-services:10.0.1'


compile 'com.firebaseui:firebase-ui-database:1.0.0'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services:10.2.1'

【问题讨论】:

  • 尝试使用最新版本的支持库
  • 您发布的依赖项包括play-services:10.0.1play-services:10.2.1。删除play-services:10.2.1
  • 始终确保您的所有 Firebase 和 Play 服务依赖项都匹配版本。在撰写本文时,最新版本是 10.2.1。

标签: android firebase dependencies


【解决方案1】:

首先 - 在 project-level build.gradle 文件中添加 google services 依赖项。

dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'com.google.gms:google-services:3.0.0'
    }

第二 - 在 app-level build.gradle 文件中,添加您想在应用中使用的各种依赖项,例如 appcompat、recyclerview、cardview、firebase 等,然后在以下位置应用播放服务插件build.gradle 文件的底部如下代码所示。

dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.firebase:firebase-ads:10.2.1'
    }

apply plugin: 'com.google.gms.google-services'

最终构建您的项目。希望对你有帮助:)

【讨论】:

    猜你喜欢
    • 2018-06-27
    • 2015-11-06
    • 2017-12-03
    • 1970-01-01
    • 2016-02-19
    • 2018-04-25
    • 1970-01-01
    • 1970-01-01
    • 2019-10-28
    相关资源
    最近更新 更多