【发布时间】:2020-09-06 12:44:29
【问题描述】:
我正在使用 Google、Facebook 和自定义服务器身份验证方法,
我使用 Twillio 消息传递 API 进行电话号码验证。
现在我想使用 Firebase 短信验证,但我无法使用 com.google.firebase:firebase-auth:19.3. 依赖项来调用方法 PhoneAuthProvider 谁能帮我指导一下?
使用 firebase-auth 依赖项在构建过程中显示此重复错误:
Gradle:
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
【问题讨论】:
标签: java android firebase firebase-authentication google-play-services