简体   繁体   English

android上的firebase:身份验证和数据库,gradle同步错误

[英]firebase on android: authentication and database, gradle sync with error

I have written an Android App that uses the Firebase database feature. 我编写了一个使用Firebase数据库功能的Android应用程序。 Everything is working fine and now I would like to integrate the Authentication feature. 一切正常,现在我想整合身份验证功能。 So I modified my build.gradle for the app to include the two dependencies for the authentication: 所以我修改了我的build.gradle,让应用程序包含两个身份验证依赖项:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.gmeunier.gestiondepoints"
        minSdkVersion 23
        targetSdkVersion 25
        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'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.google.android.gms:play-services-plus:10.2.6'
    compile 'com.google.firebase:firebase-database:10.2.6'

    compile 'com.firebaseui:firebase-ui-auth:1.2.0'
    compile 'com.google.firebase:firebase-auth:10.2.6'

    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

Despite all my efforts and research on this topic, I still have the following error when I try to sync this gradle : 尽管我对此主题进行了全部努力和研究,但在尝试同步此gradle时仍然出现以下错误:

Failed to resolve: com.twitter.sdk.android:twitter:2.3.0 无法解决:com.twitter.sdk.android:twitter:2.3.0

I can't find which lib/component versions I must use and I would appreciate help and support. 我找不到必须使用的lib / component版本,我希望得到帮助和支持。

Your project's gradle file should look like this. 您项目的gradle文件应如下所示。

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()

        // Required for 'com.firebaseui:firebase-ui:1.1.1'
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
}

Original answer: https://stackoverflow.com/a/41664069/7339411 原始答案: https//stackoverflow.com/a/41664069/7339411

Add the following line inside "repositories", inside "allprojects" and "buildscript" to your Project Level build.gradle file: 将“repositories”内的“allprojects”和“buildscript”内的以下行添加到Project Level build.gradle文件中:

maven {
    url 'https://maven.fabric.io/public'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM