Android Build.gradle DuplicateFileException错误

时间:2016-03-05 06:15:01

标签: android gradle

所以我试图将Firebase SDK合并到android studio中,然后我按照文档中的说明进行操作。这是我的错误和Gradle文件。任何帮助感谢,谢谢。

  

错误:任务':app:transformResourcesWithMergeJavaResForDebug'的执行失败。   com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在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 \ 91731b8f5868a3a8a78af29b8d06b5c358f5bb \ 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'
}

2 个答案:

答案 0 :(得分:0)

试试这段代码:

compile 'com.android.support:appcompat-v7:23.2.0'

compile 'com.android.support:support-v4:23.2.0'

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

答案 1 :(得分:0)

在build.gradle文件解决问题

上添加以下文字
Duplicate files copied in APK jsr305_annotations/Jsr305_annotations.gwt.xml 

如果获得更多错误DuplicateFileException添加带有exclude的文件。 喜欢:

错误

exclude  'jsr305_annotations/Jsr305_annotations.gwt.xml'

解决方案

{{1}}