尝试添加Firebase UI 2.3.0时,我一直收到一个gradle sync错误 [英] I keep receiving a gradle sync error when trying to add Firebase UI 2.3.0

查看:180
本文介绍了尝试添加Firebase UI 2.3.0时,我一直收到一个gradle sync错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题更新:在与教程的创建者交谈之后,我尝试使用Firebase创建实时聊天。他让我在你的Gradle中编译'com.google.firebase:firebase-core:9.4.0'
compile'c​​om.google.firebase:firebase-database:9.4.0'

Update on Question : after speaking to the creator of the Tutorial I was following trying to create Live Chat using Firebase. He told me to Change in your Gradle compile 'com.google.firebase:firebase-core:9.4.0' compile 'com.google.firebase:firebase-database:9.4.0'

如果是这种情况,那么为了使用这个9.4.0版本,我需要在我的依赖中更改什么?

If this is the case, what do I need to change in my dependencies in order to use this 9.4.0 version?

       // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.3'
            classpath 'com.google.gms:google-services:3.1.0'


            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            jcenter()
            maven { url 'https://maven.fabric.io/public' }  // <= ADD THIS
            maven {
                url "https://maven.google.com"
            }
        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }


Below is the Module:app Gradle
Here is where I am trying to compile the Firebase UI in order to make a chat application within my app:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.aids.a09application"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        aaptOptions.cruncherEnabled = false
        aaptOptions.useNewCruncher = false

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
android {
    useLibrary 'org.apache.http.legacy'
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    compile 'com.google.firebase:firebase-core:11.2.0'
    compile 'com.google.firebase:firebase-messaging:11.2.0'
    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'com.google.android.gms:play-services-maps:11.2.0'
    compile 'com.google.firebase:firebase-auth:11.2.0' // ADDED
    compile 'com.google.android.gms:play-services-auth:11.2.0' // ADDED
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.0.1'
    compile 'com.android.support:support-v4:26.0.1'
    compile 'com.android.support:recyclerview-v7:26.0.1'
    compile 'com.google.firebase:firebase-database:9.4.0'
    compile 'com.google.firebase:firebase-core:9.4.0'
}
apply plugin: 'com.google.gms.google-services'

这是我现在得到的错误:

This is the Error that I am getting now:

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.2.0.


推荐答案

使用版本11.2.0的Firebase库FirebaseUI 2.3.0,您必须更新您的依赖关系,如下所示:

To use version 11.2.0 of the Firebase libraries with FirebaseUI 2.3.0, you must update your dependencies as follows:

compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0' // ADDED
compile 'com.google.android.gms:play-services-auth:11.2.0' // ADDED
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.firebaseui:firebase-ui-auth:2.3.0'

code> firebase-auth 和 play- services-auth 是必需的,因为使用11.2.0构建的FirebaseUI版本尚不可用。这在 FirebaseUI文档中进行了解释。

The addition of firebase-auth and play-services-auth is required because a version of FirebaseUI that is built with 11.2.0 is not yet available. This is explained in the FirebaseUI documentation.

您还应该进行以下更改:

You should also make these changes:

compileSdkVersion 26
buildToolsVersion "26.0.1"

需要 compileSdkVersion 26 Google Play服务版本说明


当您将应用的Play服务依赖项升级到11.2.0或
后,您的应用的build.gradle也必须更新,以指定
compileSdkVersion至少为26 (Android O)

这篇关于尝试添加Firebase UI 2.3.0时,我一直收到一个gradle sync错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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