Javacv: Duplicated files copied in APK Error

Created on 22 Dec 2016  路  5Comments  路  Source: bytedeco/javacv

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/macosx-x86_64/libusb-1.0.dylib
File1: .gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\libdc1394\2.2.4-1.3\f1498dacc46162ab68faeb8d66cf02b96fe41c61\libdc1394-2.2.4-1.3-macosx-x86_64.jar
File2: .gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\libfreenect\0.5.3-1.3\736d65a3ef042258429d8e7742128c411806b432\libfreenect-0.5.3-1.3-macosx-x86_64.jar

Is this the right way to do it or some other approach is advisable?

duplicate

Most helpful comment

Successful solution for Duplicate files exception as below. MUST use the correct duplicateFileException file name 'org/bytedeco/javacpp/macosx-x86_64/libusb-1.0.dylib'.

packagingOptions {
pickFirst 'org/bytedeco/javacpp/macosx-x86_64/libusb-1.0.dylib'
/exclude 'META-INF/services/javax.annotation.processing.Processor'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'/
}

My exception before solved as below:
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/macosx-x86_64/libusb-1.0.dylib
File1: C:\Users\luoqg.gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\libdc1394\2.2.4-1.3\f1498dacc46162ab68faeb8d66cf02b96fe41c61\libdc1394-2.2.4-1.3-macosx-x86_64.jar
File2: C:\Users\luoqg.gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\libfreenect\0.5.3-1.3\736d65a3ef042258429d8e7742128c411806b432\libfreenect-0.5.3-1.3-macosx-x86_64.jar

All 5 comments

Duplicate of #353

Successful solution for Duplicate files exception as below. MUST use the correct duplicateFileException file name 'org/bytedeco/javacpp/macosx-x86_64/libusb-1.0.dylib'.

packagingOptions {
pickFirst 'org/bytedeco/javacpp/macosx-x86_64/libusb-1.0.dylib'
/exclude 'META-INF/services/javax.annotation.processing.Processor'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'/
}

My exception before solved as below:
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/macosx-x86_64/libusb-1.0.dylib
File1: C:\Users\luoqg.gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\libdc1394\2.2.4-1.3\f1498dacc46162ab68faeb8d66cf02b96fe41c61\libdc1394-2.2.4-1.3-macosx-x86_64.jar
File2: C:\Users\luoqg.gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\libfreenect\0.5.3-1.3\736d65a3ef042258429d8e7742128c411806b432\libfreenect-0.5.3-1.3-macosx-x86_64.jar

Use the following code block

android {
    packagingOptions {
        pickFirst 'protobuf.meta'
        }
}

Where do I put this code?
android {
packagingOptions {
pickFirst 'protobuf.meta'
}
}

@victorgomez95
in your app.gradle file add the above code

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Maleandr picture Maleandr  路  3Comments

y4nnick picture y4nnick  路  3Comments

UpAndDownAgain picture UpAndDownAgain  路  3Comments

fif10 picture fif10  路  3Comments

Bahramudin picture Bahramudin  路  3Comments