Reputation: 583
I'm trying to use Firebase to my android app and following the instruction from https://www.firebase.com/docs/android/quickstart.html to add to my build.gradle:
dependencies {
compile 'com.firebase:firebase-client-android:2.5.0+'
}
and also
android {
...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
But when i'm running the project. it produce me different error everytime i'm run the project, the error is like this:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/firebase/client/android/AndroidPlatform$2.class
and this
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/firebase/tubesock/Base64.class
Here's my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "..."
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.firebase:firebase-client-android:2.5.0'
}
and this is build.gradle for my project:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Anyone can help me with this error? any answer would be appreciated, thanks!
Upvotes: 3
Views: 3880
Reputation: 7080
it could be temporary issue. please try remove and rebuild
compile 'com.firebase:firebase-client-android:2.5.0+'
after add firebase dependencies and do rebuild again.
Upvotes: 1
Reputation: 62549
Looks like you have duplicate dependencies and you have to find out which library has it. Im not sure if you have other modules in your project but i'd do from the command line in root project folder linux/mac:
./gradlew -q dependencies yourCoolProject:dependencies --configuration compile
you can probably replace yourCoolProject with your modules name such as "app" so for me i ran it like this:
./gradlew -q dependencies app:dependencies --configuration compile
this will get me all the dependencies for my project as a tree. Then i can see if those packages its complaining about are listed twice. Then i'd use an exclude so that only one is used.
Upvotes: 0
Reputation: 5892
You have the firebase managed dependency in the build.gradle
and also he firebase jar file in the libs
folder. Please remove one of them so the project can compile properly.
Upvotes: 6