Firebase admin sdk not syncing with the gradle

主宰稳场 提交于 2019-12-11 02:27:52

问题


I have incorporated some libraries into my android app. I have connected it with Firebase cloud server. Now, I want to create tokens for User authentication. Firebase asks to add Firebase Admin Sdk to the gradle File. However, it shows error on building the gradle. The sdk I am adding is compile 'com.google.firebase:firebase-admin:5.3.1'

Following is the error:

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.

My original code is :

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

回答1:


firebase-admin doesn't belong in an Android app. It's for server side applications. If you attempt to add it to an Android app, it will definitely collide with the other Firebase libraries.

If you want to mint custom auth tokens, you have to do that on a server. Please note the title of the Firebase Admin SDK docs: Add the Firebase Admin SDK to Your Server.



来源:https://stackoverflow.com/questions/46483352/firebase-admin-sdk-not-syncing-with-the-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!