Firebase admin sdk 未与 gradle 同步

Firebase admin sdk not syncing with the gradle

我已将一些库合并到我的 android 应用程序中。我已将它与 Firebase 云服务器连接起来。现在,我想为用户身份验证创建令牌。 Firebase 要求将 Firebase Admin Sdk 添加到 gradle 文件。但是,它在构建 gradle 时显示错误。 我添加的sdk是compile 'com.google.firebase:firebase-admin:5.3.1'

错误如下:

Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (3.0.0) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

我的原代码是:

apply plugin: com.android.application

android {

compileSdkVersion 25

buildToolsVersion "25.0.2"

defaultConfig {

    applicationId "com.example.delluser.oshoguide"

    minSdkVersion 17

    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'
    }
}

packagingOptions
        {

            exclude 'META-INF/notice'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license'
            exclude 'META-INF/license.txt'
        }

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.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-crash:11.0.1'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-admin:5.3.1'

testCompile 'junit:junit:4.12'
}


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

firebase-admin 不属于 Android 应用。它用于服务器端应用程序。如果您尝试将它添加到 Android 应用程序,它肯定会与其他 Firebase 库发生冲突。

如果您想创建自定义身份验证令牌,则必须在服务器上进行。请注意 Firebase Admin SDK 文档的标题:Add the Firebase Admin SDK to Your Server.