【问题标题】:firebase on android: authentication and database, gradle sync with errorandroid上的firebase:身份验证和数据库,gradle同步错误
【发布时间】:2017-11-14 00:40:23
【问题描述】:

我编写了一个使用 Firebase 数据库功能的 Android 应用程序。一切正常,现在我想集成身份验证功能。因此,我修改了应用程序的 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'

尽管我在这个主题上付出了所有努力和研究,但当我尝试同步这个 gradle 时仍然出现以下错误:

无法解决:com.twitter.sdk.android:twitter:2.3.0

我找不到必须使用的库/组件版本,我希望能得到帮助和支持。

【问题讨论】:

    标签: android firebase firebase-realtime-database firebase-authentication


    【解决方案1】:

    您项目的 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'
            }
        }
    }
    

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

    【讨论】:

    • 它有效!多谢。我真的不明白为什么我现在需要这个 maven 东西而不是以前(即当我的应用程序中只使用数据库功能时)
    【解决方案2】:

    在“repositories”、“allprojects”和“buildscript”中添加以下行到您的项目级 build.gradle 文件:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-03
      • 2019-07-21
      • 1970-01-01
      相关资源
      最近更新 更多