Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Build.gradle DuplicateFileException Error

Tags:

android

gradle

So I'm trying to incorporate Firebase SDK in android studio and I followed the documentation to the letter. Here is my Error and Gradle File. Any help Appreciated, thanks.

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.firebase/firebase-client-jvm/pom.properties File1: C:\Users\Owner\AndroidStudioProjects\RealChatHusk\app\libs\firebase-client-android-2.5.2.jar File2: C:\Users\Owner.gradle\caches\modules-2\files-2.1\com.firebase\firebase-client-jvm\2.5.2\91731b8f5868a3e8a8a773f29b8d06b5c358f5bb\firebase-client-jvm-2.5.2.jar

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.owner.realchathusk"
    minSdkVersion 22
    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:support-v4:23.1.1'

compile 'com.android.support:design:23.1.1'

compile 'com.firebase:firebase-client-android:2.5.2'
}
like image 506
Mason Cobb Avatar asked Nov 08 '22 18:11

Mason Cobb


1 Answers

Add below text on build.gradle file solve problem

packagingOptions {
    exclude  'jsr305_annotations/Jsr305_annotations.gwt.xml'
    exclude  'build-data.properties'
 }

If getting more error DuplicateFileException add file with exclude. Like :

Error

Duplicate files copied in APK jsr305_annotations/Jsr305_annotations.gwt.xml 

Solution

exclude  'jsr305_annotations/Jsr305_annotations.gwt.xml'
like image 172
Lokesh Patel Avatar answered Nov 14 '22 23:11

Lokesh Patel