TransformException duplicate entry for common.annotations.Beta

Solution 1:

Exclude group: 'com.google.guava' from play services related dependencies.

For example:

compile ('com.google.android.gms:play-services:8.1.0'){
    exclude group: 'com.google.guava'
}

P.S. Before getting your error I've faced with a lot of different, so my final dependencies list is:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // Google
    compile 'com.google.dagger:dagger:2.0'
    apt 'com.google.dagger:dagger-compiler:2.0'
    compile ('com.google.android.gms:play-services-identity:8.1.0'){
        exclude group: 'com.google.guava'
    }
    compile ('com.google.android.gms:play-services-plus:8.1.0'){
        exclude group: 'com.google.guava'
    }
    compile ('com.google.android.gms:play-services:8.1.0'){
        exclude group: 'com.google.guava'
    }
    compile 'com.google.guava:guava:18.0'
    compile 'com.google.maps.android:android-maps-utils:0.4'

    compile('com.google.apis:google-api-services-calendar:v3-rev125-1.20.0') {
        exclude group: 'org.apache.httpcomponents'
        exclude group: 'com.android.support'
        exclude module: 'support-annotations'
        exclude group: 'com.google.guava'
    }

    // Android Design
    compile ('com.android.support:design:23.0.1'){
        exclude group: 'com.android.support'
    }
    compile ('com.android.support:recyclerview-v7:23.0.1') {
        exclude group: 'com.android.support'
    }

    compile 'com.android.support:cardview-v7:23.0.1'
    compile ('com.android.support:palette-v7:23.0.1'){
        exclude group: 'com.android.support'
    }

    // Android Support
    compile('com.android.support:appcompat-v7:22.2.0') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
        exclude group: 'com.android.support'
    }

    compile 'com.android.support:support-annotations:23.0.1'
    compile('com.android.support:support-v4:22.2.0') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
        exclude module: 'support-annotations'
    }

    // Firebase
    compile('com.firebase:firebase-client-android:2.3.1') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
    }
    compile('com.firebase:firebase-client-jvm:2.3.0') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
    }

    // Joda Time
    compile 'net.danlew:android.joda:2.8.0'
    compile 'org.joda:joda-convert:1.2'

    // Square
    compile 'com.squareup:otto:1.3.5'
    compile 'com.jakewharton:butterknife:7.0.1'
    provided 'javax.annotation:jsr250-api:1.0'

    // Common
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'org.apache.commons:commons-collections4:4.0'

    compile ('com.bignerdranch.android:expandablerecyclerview:1.0.3'){
        exclude group: 'com.android.support'
    }
}

Solution 2:

I got this error when I had different versions of play services libs in my app module and a library module.

Solution 3:

I found the reason to be the incorrectly configured dagger-compiler:

compile 'com.google.dagger:dagger-compiler:2.1'

What I had done is to modify project' build.gradle:

buildscript {
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

And later the application build.gradle:

First, add plugin:

apply plugin: 'com.neenbedankt.android-apt'

And later modify the dependency to:

apt "com.google.dagger:dagger-compiler:2.1"