在Android Studio中使用gradle构建时,在APK中复制的文件重复

时间:2017-07-07 18:46:51

标签: android gradle

尝试构建项目时出现以下错误:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/bytedeco/javacpp/windows-x86/msvcp120.dll
    File1: C:\Users\yuh5\.gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\opencv\3.1.0-1.3\3d455d0c218e90072827d5b22b4163b1eea323e9\opencv-3.1.0-1.3-windows-x86.jar
    File2: C:\Users\yuh5\.gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\hdf5\1.10.0-patch1-1.3\76b579910f51cd628bed8f6cbb245670483b9eeb\hdf5-1.10.0-patch1-1.3-windows-x86.jar

这是我的gradle构建脚本:

apply plugin:'com.android.application'

android {     compileSdkVersion 23     buildToolsVersion“25.0.1”

defaultConfig {
    applicationId "com.yuh5.nih.testall"
    minSdkVersion 19
    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/DEPENDENCIES'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/INDEX.LIST'
    }
}
dependencies {
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile project(':libraries:opencv')
    compile 'org.deeplearning4j:deeplearning4j-core:0.8.0'
    compile 'org.nd4j:nd4j-native:0.8.0'
    compile 'org.nd4j:nd4j-native:0.8.0:android-x86'
    compile 'org.nd4j:nd4j-native:0.8.0:android-arm'
}

1 个答案:

答案 0 :(得分:0)

试试这个:

values.email