0

I have been using realtime Firebase for my app for some time .I need to add Firestore to my project . when adding firestore , I have a duplication error . I would like to exclude modules from firestore and not from other libs . I can not identify which module should be removed besides gson that was also duplicated.

implementation('com.google.firebase:firebase-firestore:24.1.2'){ exclude module: 'gson', exclude module:???? } It seems very close or a duplicate of some other questions but none of the given answsers in previous questions worked

I can not give all gradle because file is very large but main google elements are :

implementation 'com.google.firebase:firebase-database:20.0.0'
implementation 'com.google.firebase:firebase-auth:20.0.0'
implementation 'com.google.firebase:firebase-core:20.0.0'
implementation 'com.google.firebase:firebase-functions:20.0.0'
implementation 'com.google.firebase:firebase-storage:20.0.0'

implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

implementation('com.google.firebase:firebase-firestore:20.0.0') {
    exclude module: 'gson'
    exclude module: 'com.google.gauva:gauva-jdk5:17.0'
}


implementation 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient' exclude module: 'com.google.gauva:gauva-jdk5:17.0'

I supppose issue comes from implementation files('libs\deeparteffects-android-client-1.0.0-jar-with-dependencies.jar') but i can not really test it

Duplicate class com.google.common.util.concurrent.WrappingExecutorService found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.common.util.concurrent.WrappingExecutorService$1 found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.common.util.concurrent.WrappingScheduledExecutorService found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.common.util.concurrent.package-info found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.common.xml.XmlEscapers found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.common.xml.package-info found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.thirdparty.publicsuffix.PublicSuffixPatterns found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.thirdparty.publicsuffix.PublicSuffixType found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Duplicate class com.google.thirdparty.publicsuffix.TrieParser found in modules jetified-guava-30.1.1-android (com.google.guava:guava:30.1.1-android) and jetified-guava-jdk5-17.0 (com.google.guava:guava-jdk5:17.0)
Divyani Yadav
  • 1,030
  • 4
  • 9
it75
  • 125
  • 10
  • Does this answer your question? [Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-20.0.jar (com.google.guava:guava:20.0)](https://stackoverflow.com/questions/56639529/duplicate-class-com-google-common-util-concurrent-listenablefuture-found-in-modu) – user3738870 Jun 11 '22 at 13:15
  • Thanx, i tried both answers given for this questions and none worked . Weird to have this issue just with firestore and not realtime firebase – it75 Jun 11 '22 at 13:32
  • can you share your build.gradle file and check for the link : https://stackoverflow.com/a/61982002/15774176 is it helpful? – Divyani Yadav Jun 13 '22 at 10:31
  • Hi, issue seems very similar but just adding elements in the configurations part makes the build fail .I don t which causes duplication issues, i supsect an external modul deepart, but i can not confirm . i can not exclude anything from this module i guess – it75 Jun 13 '22 at 13:31
  • is this issue resolved by exclusion ? – Divyani Yadav Jun 20 '22 at 12:33
  • No still not working – it75 Jun 20 '22 at 13:00
  • is this answer helpful : https://stackoverflow.com/a/60475474/15774176 ? – Divyani Yadav Jun 29 '22 at 10:12
  • It didn t help. I don t think this can be related to a specific version of firestore . – it75 Jun 29 '22 at 17:24
  • are you able to see anything in logs? – Divyani Yadav Jul 05 '22 at 08:15
  • Logs are displayed in the question – it75 Jul 09 '22 at 12:27
  • implementation 'com.google.guava:guava:31.1-android' have you added it? – Divyani Yadav Jul 13 '22 at 10:04
  • Crashes also by adding guava . As far as i understood, guava is already present in the other implement elements anyway. – it75 Jul 13 '22 at 14:01

1 Answers1

0

You may find this stackoverflow post helpful to understand the dependency tree.

the syntax you are using does not match what most documents state : 2 3 4.

your syntax :

implementation('com.google.firebase:firebase-firestore:20.0.0') {
        exclude module: 'gson'
        exclude module: 'com.google.gauva:gauva-jdk5:17.0'
    }

As mentioned in blog:

configurations.implementation {
    exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}

As mentioned in Thread:

implementation ('com.google.apis:google-api-services-youtube:v3-rev183-1.22.0') {
    exclude group: 'org.apache.httpcomponents'
    exclude group:'com.google.guava'
}

As mentioned in Thread:

configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types')

Try changing the configuration syntax to get the desired results

configurations.implementation {
  exclude group: 'com.google.gauva', module: 'gauva-jdk5'
} 

or

configurations.implementation.exclude(group: 'com.google.gauva', module: 'gauva-jdk5') 
Divyani Yadav
  • 1,030
  • 4
  • 9