Transformexception Duplicate Entry for Common.Annotations.Beta

TransformException duplicate entry for common.annotations.Beta

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'
}
}

zip.ZipException: duplicate entry: annotations/Beta.class

In order to systematically resolve "ZipException: duplicate entry" errors check out my answer here. If you do not use multidex, just ignore the multidex part. I encountered the exact same error regarding Beta.class and resolved it by excluding all occurences of guava:

compile ('com.google.dagger:dagger:2.4') {
exclude group: 'com.google.guava'
}

Guava library duplicate entry error

I actually did fix this problem, forgot to post it.

So the issue here was I was using maven/gradle dependency in my project BUT the chromium_webview library was using an actual JAR file as a library.

I modified the library to use the maven/gradle dependency. Android Studio and Gradle did all the work for me and excluded the necessary classes.

So make sure they both (library and your module) use the same method.

compile 'com.google.guava:guava:18.0'

I really hope this helps someone.

Thank you.

How to solve java.util.zip.ZipException duplicate entry: com/google/gson/annotations/Expose.class?

You should exclude module: 'gson'from twitter dependency like

 compile('com.twitter.sdk.android:twitter:1.10.0@aar') {
transitive = true;
exclude module: 'gson'
}

You already added GSON as gson-2.3.1.jar

Build Failed when i try to run the app

As @Vaiden says the issue was:

"It seems that you have at least one library already bundled with GMS"

Every time that you face a duplicate entry error run ./gradlew app:dependencies and make sure that there is no duplicated versions of a same module. For example: in my case I had:

compile 'com.google.android.gms:play-services-gcm:9.0.0'

When I tried to use firebase in my project I add it like:

compile 'com.google.firebase:firebase-core:9.+'
compile 'com.google.firebase:firebase-messaging:9.+'

That makes my app crash cause when I navigate to the: app > build > intermediates > exploded-aar > com.google.android.gms one of the folders (play-services-basement) pull a version 9.4.0 instead 9.0.0 so what I did was to unificate the versions by adding firebase like:

compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'

In theory you can solve this too by pushing the firebase to 9.4.0 instead.

The bottom line is to try to know which things are your dependencies introducing to the app and check "WHO" is introducing the same thing to the app, once you get there try to set a specific version of that duplicated dependency.

Getting build error: `duplicate entry: javax/annotation/CheckForNull.class`

Well, I solved my problem by replacing compile with apt in the dagger compiler dependency

/**
* Dependency Injection
* */
apt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.dagger:dagger:2.7'
provided 'javax.annotation:jsr250-api:1.0'


Related Topics



Leave a reply



Submit