gpt4 book ai didi

android - 在APK Android中复制的重复文件

转载 作者:行者123 更新时间:2023-12-03 05:55:36 25 4
gpt4 key购买 nike

尝试编译我的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被包含在两个地方,但是我不知道该怎么做以及如何执行“排除”或“优先选择”来消除此错误。

我的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.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'

}

最佳答案

将此添加到packagingOptions中:

 pickFirst 'org/bytedeco/javacpp/windows-x86/msvcp120.dll'

关于android - 在APK Android中复制的重复文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45061800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com