0

尝试编译我的 Android 项目时,我遇到了“在 APK 中复制的重复文件”问题。

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

它说这是因为 msvcp120.dll 包含在两个地方,但我不知道如何执行“排除”或“pickfirst”以消除此错误。

我的毕业脚本:

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.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.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'){
        exclude group: 'org.json', module: 'json'
    }
    compile 'org.nd4j:nd4j-native:0.8.0'
    compile 'org.nd4j:nd4j-native:0.8.0:android-arm'

}
4

1 回答 1

0

将其添加到packagingOptions

 pickFirst 'org/bytedeco/javacpp/windows-x86/msvcp120.dll'
于 2017-07-12T15:34:38.393 回答