使用自己的身份验证服务器的firebase-auth模块和firebase-common-auth的重复

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用自己的身份验证服务器的firebase-auth模块和firebase-common-auth的重复相关的知识,希望对你有一定的参考价值。

我正在使用Google,Facebook和自定义服务器身份验证方法,我正在使用Twillio消息传递API进行电话号码验证。

现在我想使用Firebase短信验证,但无法使用com.google.firebase:firebase-auth:19.3依赖项来调用方法PhoneAuthProvider谁能帮助我进行指导?

使用firebase-auth依赖项在构建期间显示此重复错误:

等级:

Duplicate class com.google.firebase.auth.AuthCredential found in modules jetified-firebase-auth- 
19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common- 
9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.EmailAuthCredential found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.EmailAuthProvider found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.FacebookAuthCredential found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.FacebookAuthProvider found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.FirebaseAuthProvider found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.GithubAuthCredential found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.GithubAuthProvider found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.GoogleAuthCredential found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.GoogleAuthProvider found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.TwitterAuthCredential found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.TwitterAuthProvider found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.UserInfo found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.UserProfileChangeRequest found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.UserProfileChangeRequest$Builder found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1)
Duplicate class com.google.firebase.auth.zza found in modules jetified-firebase-auth-19.3.1-runtime.jar (com.google.firebase:firebase-auth:19.3.1) and jetified-firebase-auth-common-9.6.1-runtime.jar (com.google.firebase:firebase-auth-common:9.6.1) 
Go to the documentation to learn how to Fix dependency resolution errors

gradle.build(project)依赖项是

 dependencies 
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    

gradle.build(应用程序级)

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript 
    repositories 
        maven  url 'https://maven.fabric.io/public' 
    

    dependencies 
        classpath 'io.fabric.tools:gradle:1.+'
    

repositories 
    maven  url 'https://maven.fabric.io/public' 


android 

    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    aaptOptions.cruncherEnabled = false
    aaptOptions.useNewCruncher = false
    buildToolsVersion

    defaultConfig 
        applicationId "com.orderdoo.customer"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    

    lintOptions 
        checkReleaseBuilds false
        abortOnError false;
        disable 'deprecation'
    

    dexOptions 
        javaMaxHeapSize "4g"
        jumboMode true
    


    buildTypes 
        release 
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        
    

    compileOptions 
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    

    allprojects 

        tasks.withType(JavaCompile) 
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        


        repositories 
            mavenCentral()
            mavenLocal()
            jcenter()
            google()
            maven  url "https://jitpack.io" 
            maven  url "https://s3.amazonaws.com/repo.commonsware.com" 
            maven 
                url "https://maven.google.com"
            

        

        packagingOptions 
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/LGPL2.1'
            exclude 'META-INF/services/javax.annotation.processing.Processor'
        

    




dependencies 
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation('com.squareup.retrofit2:converter-simplexml:2.3.0') 
        exclude group: 'xpp3', module: 'xpp3'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'
    
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
    implementation 'androidx.percentlayout:percentlayout:1.0.0'
    implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'com.github.markushi:circlebutton:1.1'
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'com.github.arimorty:floatingsearchview:2.1.1'
    implementation 'com.romandanylyk:pageindicatorview:0.2.0'

    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.github.reinaldoarrosi:maskededittext:1.1.0'
    implementation 'com.facebook.android:facebook-login:[5,6)'
    implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation 'com.hedgehog.ratingbar:app:1.1.2'
    implementation 'uk.co.ribot:easyadapter:1.5.0@aar'
    implementation 'com.github.rahimlis:badgedtablayout:v1.2'
    implementation 'com.kaopiz:kprogresshud:1.1.0'
    implementation 'com.gmail.samehadar:iosdialog:1.0'
    implementation 'com.github.jd-alexander:library:1.1.0'
    implementation 'com.facebook.fresco:fresco:2.0.0'


    implementation "com.google.firebase:firebase-core:16.0.4"
    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-messaging:20.1.7'
    implementation 'com.google.firebase:firebase-auth:19.3.1' //this generates duplication

    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    implementation 'com.github.ar-android:DrawRouteMaps:1.0.0'

    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'in.srain.cube:ultra-ptr:1.0.11'

    implementation 'com.code-troopers.betterpickers:library:3.1.0'
    implementation 'com.miguelcatalan:materialsearchview:1.4.0'

    implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'

    implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') 
        transitive = true;
    


    implementation 'org.jetbrains:annotations:15.0'



apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
答案

尝试执行此命令,因为在终端中使用以下命令来运行构建很有用:

./gradlew --info assembleDebug

因为这将帮助您找出冲突中涉及的所有依赖项的完整列表:

[依赖关系解析帮助:显示任何依赖关系版本的所有当前已知路径:工件(groupId = com.google.firebase,artifactId = firebase-iid)

-- task/module dep -> firebase-analytics@17.2.0
---- firebase-analytics:17.2.0 library depends -> play-services-measurement-api@17.2.0
------ play-services-measurement-api:17.2.0 library depends -> firebase-iid@19.0.0

-- task/module dep -> firebase-core@17.2.0
---- firebase-core:17.2.0 library depends -> firebase-analytics@17.2.0
------ firebase-analytics:17.2.0 library depends -> play-services-measurement-api@17.2.0
-------- play-services-measurement-api:17.2.0 library depends -> firebase-iid@19.0.0

-- task/module dep -> play-services-measurement-api@17.2.0
---- play-services-measurement-api:17.2.0 library depends -> firebase-iid@19.0.0

-- task/module dep -> firebase-iid@19.0.0

-- task/module dep -> firebase-messaging@17.1.0
---- firebase-messaging:17.1.0 library depends -> firebase-iid@[16.2.0]

-- task/module dep -> com.pressenger:sdk@4.8.0
---- com.pressenger:sdk:4.8.0 library depends -> firebase-messaging@17.1.0
------ firebase-messaging:17.1.0 library depends -> firebase-iid@[16.2.0]

从此列表中,您将了解两件事:

冲突的依赖关系在哪里以及冲突的依赖关系的版本是什么。

在这种情况下,冲突的依赖项是firebase-iid:它是@ 19.0.0或@ 16.2.0

要解决此问题,您必须在build.gradle中明确定义错误的firebase-iid的顶级依赖关系。

因此,在以上日志中,您可以看到有2个示例的firebase-iid@16.2.0的过时版本。一个来自-任务/模块dep-> firebase-messaging@17.1.0,另一个来自第三方库。我们没有控制第三方库的功能,因此在此无所事事。

但是对于其他依赖,我们必须使用正确的版本明确声明它,这将强制使用此版本:

实现'com.google.firebase:firebase-messaging:20.0.0'

所以也许您可以使用此命令了解问题的根本原因是什么。

以上是关于使用自己的身份验证服务器的firebase-auth模块和firebase-common-auth的重复的主要内容,如果未能解决你的问题,请参考以下文章

使用自己的身份验证服务器的firebase-auth模块和firebase-common-auth的重复

使用其他API进行Firebase身份验证

AWS Cognito 如何验证我自己的 IdP 颁发的身份令牌?

使用google身份验证器实现动态口令验证

对于仅由其他Web服务使用的Web API,建议的身份验证类型是什么

使用 OAuth 进行服务器到服务器身份验证?