Firebase管理员sdk不会与Gradle同步 [英] Firebase admin sdk not syncing with the gradle
问题描述
我添加的sdk是编译
'com.google.firebase:firebase-admin:5.3.1'
以下是错误:
lockquote
错误:与$ b中的依赖关系com.google.code.findbugs:jsr305冲突$ b项目':app'。应用程序(3.0.0)和测试应用程序(2.0.1)
的已解决版本不同。请参阅 http://g.co/androidstudio/app-test-app-conflict for
details。
我的原始代码是:
apply plugin:com.android.application
android {
compileSdkVersion 25
buildToolsVersion25.0 .2
defaultConfig {
applicationIdcom.example.delluser.oshoguide
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName1.0
testInstrumentationRunner
android.support.test.runner.AndroidJUnitRunner
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard- android.txt'),
'proguard-rules.pro'
}
}
packagingOptions
{
不含ude'META-INF / notice'
排除'META-INF / notice.txt'
排除'META-INF / license'
排除'META-INF / license.txt'
编译fileTree(dir:'libs',include:['* .jar'])
androidTestCompile('com.android.support.test .espresso:espresso-core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
})
编译'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'
编译'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.fireba seui: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文档的标题:将Firebase Admin SDK添加到您的服务器。
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'`
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.
这篇关于Firebase管理员sdk不会与Gradle同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!