I'm encountering this duplicate file error when building an app on Android Studio with Gradle:
Error:duplicate files during packaging of APK /Users/lgorse/AndroidStudioProjects/Androidhive-test/app/build/outputs/apk/app-debug-unaligned.apk
Path in archive: lib/armeabi/libavcodec-55.so
Origin 1: /Users/lgorse/AndroidStudioProjects/Androidhive-test/app/build/intermediates/exploded-aar/io.cine/cineio-broadcast-android-sdk/0.0.9/jni/armeabi/libavcodec-55.so
Origin 2: /Users/lgorse/AndroidStudioProjects/Androidhive-test/app/build/intermediates/exploded-aar/Androidhive-test/kickflip-android-sdk/unspecified/jni/armeabi/libavcodec-55.so
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'lib/armeabi/libavcodec-55.so'
}
}
I already implemented the solution in this answer. However the problem persists.
I've actually tried to exlcude the package in all 3 build.gradles (the app, and the two modules for the dependencies).
Here is an example of how it looks like on the app build.gradle:
android {
compileSdkVersion 21
buildToolsVersion '21.1'
defaultConfig {
applicationId "com.example.lgorse.androidhive_test"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{
debuggable true
}
}
packagingOptions {
exclude 'lib/armeabi/libavcodec-55.so'
}
}