I'm using Google, Facebook and custom server authentication methods,
I was using Twillio messaging API for phone number verification.
Now I want to use Firebase sms verification, but I am unable to use com.google.firebase:firebase-auth:19.3. dependency for calling method PhoneAuthProvider Can anyone help me to guide on it?
Using firebase-auth dependency shows this duplication error during build:
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 are
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(app-level)
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
Try execute this command as it is useful to run the build in the terminal with the following command:
./gradlew --info assembleDebug
as this will help you to figure out the complete list of all dependencies which are getting involved in conflicts:
Dependency Resolution Help: Displaying all currently known paths to any version of the dependency: Artifact(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]
From this list you will get to know 2 things:
Where is the conflicting dependency and What versions of the conflicting dependency are.
In this case the conflicting dependency is firebase-iid: It's either @19.0.0 or @16.2.0
To fix this you must define the top-level dependency of the wrong firebase-iid explicitly in your build.gradle
.
So in the above logs you can see that there are 2 examples of an out-dated version of firebase-iid@16.2.0. One comes from -- task/module dep -> firebase-messaging@17.1.0 the other one from a third-party library. We don't have control on the third-party library, so nothing to do here.
But for the other dependency, we have to declare it explicitly with the correct version which will force to use this one:
implementation 'com.google.firebase:firebase-messaging:20.0.0'
So might be you can get an idea using this command that what is the main root cause of your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.