Testing
Testing

Reputation: 11

How do I fix java.util.zip.ZipException: duplicate entry: com/google/firebase/FirebaseApiNotAvailableException.class?

I am getting the error: Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/FirebaseApiNotAvailableException.class

with code:

dependencies {
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:mediarouter-v7:24.0.0'
compile(files('libs/play-hub-support.jar'))

compile('com.google.android.gms:play-services-cast:8.3.0') {
    exclude group: 'com.google.android.gms'
}
compile('com.google.android.gms:play-services-analytics:8.3.0') {
    exclude group: 'com.google.android.gms'
}
compile('com.google.android.gms:play-services-auth:9.0.2') {
    exclude group: 'com.google.android.gms'
}
compile('com.google.android.gms:play-services-ads:11.2.0') {
    exclude group: 'com.google.android.gms'
}

compile 'com.android.support:multidex:1.0.1'
compile 'com.larswerkman:HoloColorPicker:1.5'

}

Upvotes: 1

Views: 211

Answers (2)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 365138

Don't use different versions of Google Play Services and Firebase

compile('com.google.android.gms:play-services-cast:8.3.0')
compile('com.google.android.gms:play-services-analytics:8.3.0')
compile('com.google.android.gms:play-services-auth:9.0.2')
compile('com.google.android.gms:play-services-ads:11.2.0')

Use the latest version without excluding them self(*):

compile('com.google.android.gms:play-services-cast:11.4.0')
compile('com.google.android.gms:play-services-analytics:11.4.0')
compile('com.google.android.gms:play-services-auth:11.4.0')
compile('com.google.android.gms:play-services-ads:11.4.0')

(*)This exclude doesn't make sense. Remove it in your dependencies.

exclude group: 'com.google.android.gms'

Upvotes: 3

egoldx
egoldx

Reputation: 1520

Use same version for all play services

Upvotes: 1

Related Questions