I'm developing an app where I would use google sheets/photos and also firestore. The error started coming when I add firestore dependency in gradle. If I remove firestore it is building fine. I want both google dependencies for photos later and also firestore. Please help

I generated gradle dependency and tried few things like `exlude guave etc.. nothing worked.

Tried - multidex true , clean rbuild invalidate caches..did not work I feel some dependency is duplicated because of which this error is coming.

APP build gradle file

app/build gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.savera.nammaflat"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    //Google sheets
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'pub.devrel:easypermissions:2.0.1'
    implementation('com.google.api-client:google-api-client-android:1.23.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    implementation('com.google.apis:google-api-services-sheets:v4-rev506-1.23.0') {
        exclude group: 'org.apache.httpcomponents'
    }

    // Firebase Authentication
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-firestore:18.2.0'
    implementation 'com.google.firebase:firebase-auth:16.2.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
}

apply plugin: 'com.google.gms.google-services'

PROJECT gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
  }

DEPENDENCY OUTPUT

    > Task :app:androidDependencies
    debug
    debugCompileClasspath - Dependencies for compilation
    +--- com.android.support:design:28.0.0@aar
    +--- pub.devrel:easypermissions:2.0.1@aar
    +--- com.android.support:appcompat-v7:28.0.0@aar
    +--- com.android.support.constraint:constraint-layout:1.1.3@aar
    +--- com.google.android.gms:play-services-auth:16.0.1@aar
    +--- com.google.api-client:google-api-client-android:1.23.0@jar
    +--- com.google.apis:google-api-services-sheets:v4-rev506-1.23.0@jar
    +--- com.google.firebase:firebase-core:16.0.8@aar
    +--- com.google.firebase:firebase-firestore:18.2.0@aar
    +--- com.google.firebase:firebase-auth:16.2.0@aar
    +--- com.android.support:recyclerview-v7:28.0.0@aar
    +--- com.android.support:cardview-v7:28.0.0@aar
    +--- com.google.android.gms:play-services-auth-api-phone:16.0.0@aar
    +--- com.google.android.gms:play-services-auth-base:16.0.0@aar
    +--- com.google.firebase:firebase-auth-interop:16.0.1@aar
    +--- com.google.android.gms:play-services-flags:16.0.1@aar
    +--- com.google.firebase:firebase-analytics:16.4.0@aar
    +--- com.google.android.gms:play-services-measurement-api:16.4.0@aar
    +--- com.google.firebase:firebase-iid:17.0.3@aar
    +--- com.google.firebase:firebase-iid-interop:16.0.1@aar
    +--- com.google.android.gms:play-services-base:16.0.1@aar
    +--- com.google.firebase:firebase-common:16.1.0@aar
    +--- com.google.android.gms:play-services-tasks:16.0.1@aar
    +--- com.google.android.gms:play-services-measurement:16.4.0@aar
    +--- com.google.android.gms:play-services-measurement-sdk:16.4.0@aar
    +--- com.google.android.gms:play-services-measurement-impl:16.4.0@aar
    +--- com.google.android.gms:play-services-measurement-sdk-api:16.4.0@aar
    +--- com.google.android.gms:play-services-measurement-base:16.4.0@aar
    +--- com.google.android.gms:play-services-stats:16.0.1@aar
    +--- com.google.firebase:firebase-measurement-connector:17.0.1@aar
    +--- com.google.android.gms:play-services-ads-identifier:16.0.0@aar
    +--- com.google.android.gms:play-services-basement:16.2.0@aar
    +--- com.android.support:support-v4:26.1.0@aar
    +--- com.android.support:support-fragment:28.0.0@aar
    +--- com.android.support:animated-vector-drawable:28.0.0@aar
    +--- com.android.support:support-core-ui:28.0.0@aar
    +--- com.android.support:support-core-utils:28.0.0@aar
    +--- com.android.support:support-vector-drawable:28.0.0@aar
    +--- com.android.support:transition:28.0.0@aar
    +--- com.android.support:loader:28.0.0@aar
    +--- com.android.support:viewpager:28.0.0@aar
    +--- com.android.support:coordinatorlayout:28.0.0@aar
    +--- com.android.support:drawerlayout:28.0.0@aar
    +--- com.android.support:slidingpanelayout:28.0.0@aar
    +--- com.android.support:customview:28.0.0@aar
    +--- com.android.support:swiperefreshlayout:28.0.0@aar
    +--- com.android.support:asynclayoutinflater:28.0.0@aar
    +--- com.android.support:support-media-compat:26.1.0@aar
    +--- com.android.support:support-compat:28.0.0@aar
    +--- com.android.support:versionedparcelable:28.0.0@aar
    +--- com.android.support:collections:28.0.0@jar
    +--- com.android.support:cursoradapter:28.0.0@aar
    +--- android.arch.lifecycle:runtime:1.1.1@aar
    +--- com.android.support:documentfile:28.0.0@aar
    +--- com.android.support:localbroadcastmanager:28.0.0@aar
    +--- com.android.support:print:28.0.0@aar
    +--- android.arch.lifecycle:viewmodel:1.1.1@aar
    +--- com.android.support:interpolator:28.0.0@aar
    +--- android.arch.lifecycle:livedata:1.1.1@aar
    +--- android.arch.lifecycle:livedata-core:1.1.1@aar
    +--- android.arch.lifecycle:common:1.1.1@jar
    +--- android.arch.core:runtime:1.1.1@aar
    +--- android.arch.core:common:1.1.1@jar
    +--- com.android.support:support-annotations:28.0.0@jar
    +--- com.android.support.constraint:constraint-layout-solver:1.1.3@jar
    +--- com.google.api-client:google-api-client:1.23.0@jar
    +--- com.google.http-client:google-http-client-android:1.23.0@jar
    +--- com.google.firebase:firebase-database-collection:16.0.1@aar
    +--- com.google.firebase:protolite-well-known-types:16.0.1@aar
    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava@jar
    +--- io.grpc:grpc-okhttp:1.16.1@jar
    +--- com.squareup.okhttp:okhttp:2.7.5@jar
    +--- io.grpc:grpc-android:1.16.1@aar
    +--- io.grpc:grpc-protobuf-lite:1.16.1@jar
    +--- io.grpc:grpc-stub:1.16.1@jar
    +--- com.google.oauth-client:google-oauth-client:1.23.0@jar
    +--- com.google.http-client:google-http-client-jackson2:1.23.0@jar
    +--- com.google.guava:guava-jdk5:17.0@jar
    +--- com.google.http-client:google-http-client:1.23.0@jar
    +--- com.google.auto.value:auto-value-annotations:1.6@jar
    +--- com.google.protobuf:protobuf-lite:3.0.1@jar
    +--- com.squareup.okio:okio:1.13.0@jar
    +--- io.grpc:grpc-core:1.16.1@jar
    +--- com.google.guava:guava:26.0-android@jar
    +--- com.google.code.findbugs:jsr305:3.0.2@jar
    +--- com.fasterxml.jackson.core:jackson-core:2.1.3@jar
    +--- io.grpc:grpc-context:1.16.1@jar
    +--- com.google.code.gson:gson:2.7@jar
    +--- io.opencensus:opencensus-contrib-grpc-metrics:0.12.3@jar
    +--- io.opencensus:opencensus-api:0.12.3@jar
    +--- com.google.errorprone:error_prone_annotations:2.2.0@jar
    +--- org.codehaus.mojo:animal-sniffer-annotations:1.17@jar
    +--- org.checkerframework:checker-compat-qual:2.5.2@jar
    \--- com.google.j2objc:j2objc-annotations:1.1@jar
Answer

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions