Tommaso Desario
Tommaso Desario

Reputation: 41

problems when i try to add google places library to my project

sorry for my english... ok lets go, when i add the dependencie of google places libraries and sync its every thing ok but till i build, show a duplicate class error i tried top add an annotation processor but it does not work... i hope some help thanks.

the librarie: implementation 'com.google.android.libraries.places:places:1.1.0'

tried to solve implements this dependencies

    annotationProcessor 'com.google.auto.value:auto-value:1.6.2'
    implementation 'com.google.auto.value:auto-value-annotations:1.6.2'

and upgrading the dependencie but unlucky

    implementation 'com.google.auto.value:auto-value:1.6.5'
    implementation 'com.google.auto.value:auto-value-annotations:1.6.5'

my dependencies

dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        //noinspection GradleCompatible

        implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
        implementation "com.android.support:design:$supportLibraryVersion"
        implementation "com.android.support:support-v4:$supportLibraryVersion"
        implementation "com.android.support:palette-v7:$supportLibraryVersion"
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'

        //annotationProcessor 'com.google.auto.value:auto-value:1.6.2'
        //implementation 'com.google.auto.value:auto-value-annotations:1.6.2'
        //implementation 'com.google.auto.value:auto-value:1.6.5'
        //implementation 'com.google.auto.value:auto-value-annotations:1.6.5'
        //annotationProcessor 'com.google.auto.value:auto-value-compiler:1.6.5'

        implementation 'com.google.android.libraries.places:places:1.1.0'

        implementation 'com.github.bumptech.glide:glide:4.9.0'

        annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

        implementation 'com.google.firebase:firebase-core:16.0.4'
        implementation 'com.google.firebase:firebase-messaging:17.3.4'
        implementation 'com.google.firebase:firebase-auth:16.0.5'
        implementation 'com.google.firebase:firebase-database:16.0.5'
        implementation 'com.google.firebase:firebase-storage:15.0.2'
        implementation 'com.google.firebase:firebase-ads:17.0.0'
        implementation 'com.google.firebase:firebase-functions:16.1.1'
        implementation 'com.firebaseui:firebase-ui-auth:4.3.2'
        implementation 'com.google.android.gms:play-services-maps:16.1.0'
        implementation 'com.google.android.gms:play-services-location:16.0.0'
        implementation 'de.hdodenhof:circleimageview:2.2.0'
        implementation 'com.zhihu.android:matisse:0.5.2-beta3'
        implementation 'com.github.chrisbanes:PhotoView:2.1.4'
        implementation 'com.github.hani-momanii:SuperNova-Emoji:1.1'
        implementation 'com.kailashdabhi:om-recorder:1.1.5'
        implementation 'com.github.lzyzsd:circleprogress:1.2.1'
        implementation 'com.github.codekidX:storage-chooser:2.0.4.2'
        implementation 'com.fxn769:musicwave:1.0'
        implementation 'ca.barrenechea.header-decor:header-decor:0.2.8'
        implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'
        implementation 'com.devlomi.record-view:record-view:2.0.1'
        implementation 'io.realm:android-adapters:3.1.0'
        implementation 'com.devlomi.hidely:hidely:1.0.0'
        implementation 'com.github.broakenmedia:MultiContactPicker:1.8.5'
        implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
        implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
        implementation 'com.github.ozodrukh:CircularReveal:1.1.0'
        implementation 'com.github.oxoooo:pull-back-layout:1.0.1'
        implementation 'io.michaelrocks:libphonenumber-android:8.4.1'
        implementation 'org.greenrobot:eventbus:3.0.0'
        implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.3'
        implementation 'com.android.support:multidex:1.0.3'
        implementation 'me.zhanghai.android.systemuihelper:library:1.0.0'
        implementation 'com.evernote:android-job:1.2.6'
        implementation 'com.devlomi:circularstatusview:1.0.1'
        implementation 'com.android.support:support-v4:28.0.0'
        testImplementation 'junit:junit:4.12'
        implementation project(path: ':cameraView')
        implementation project(path: ':stories-progress-view')
        implementation(name: 'sinch-android-rtc-3.12.8', version: '3.12.8', ext: 'aar')
        implementation 'com.txusballesteros:AutoscaleEditText:1.0'
        implementation('com.google.cloud:google-cloud-translate:1.12.0') {
            exclude group: 'org.apache.httpcomponents'
            exclude group: 'org.json', module: 'json'
        }
        annotationProcessor 'com.google.cloud:google-cloud-translate:1.12.0'
        implementation 'com.android.support:recyclerview-v7:28.0.0'
    }

    repositories {
        mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }

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

the error

Duplicate class com.google.auto.value.AutoAnnotation found in modules auto-value-1.2.jar (com.google.auto.value:auto-value:1.2) and auto-value-annotations-1.6.2.jar (com.google.auto.value:auto-value-annotations:1.6.2)
Duplicate class com.google.auto.value.AutoValue found in modules auto-value-1.2.jar (com.google.auto.value:auto-value:1.2) and auto-value-annotations-1.6.2.jar (com.google.auto.value:auto-value-annotations:1.6.2)
Duplicate class com.google.auto.value.AutoValue$Builder found in modules auto-value-1.2.jar (com.google.auto.value:auto-value:1.2) and auto-value-annotations-1.6.2.jar (com.google.auto.value:auto-value-annotations:1.6.2)

Go to the documentation to learn how to Fix dependency resolution errors.

Upvotes: 2

Views: 2238

Answers (2)

James Christian Kaguo
James Christian Kaguo

Reputation: 1469

Add this in your gradle(app)

configurations.all {
    resolutionStrategy {
        force("com.google.auto.value:auto-value:1.6.3")
    }
}

Upvotes: 2

Tommaso Desario
Tommaso Desario

Reputation: 41

i solved the error, executing dependencies task via gradle to see all dependecies tree. its shows al dependencies and sub-dependencies helped me to find what other dependency was using (com.google.auto.value:auto-value:1.2) and i found the problem in google tannslate dependecy, so only excluded from ('com.google.cloud:google-cloud-translate:1.12.0') the duplicated dependency.

In this way was the google translate dependency:

implementation('com.google.cloud:google-cloud-translate:1.12.0') {
    exclude group: 'org.apache.httpcomponents'
    exclude group: 'org.json', module: 'json'
    exclude group: 'com.google.auto.value', module: 'auto-value'
}

hope can help any other with the same or similar problem

Upvotes: 2

Related Questions