1

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'
    }

}
Community
  • 1
  • 1
Laurent
  • 1,554
  • 19
  • 42
  • It seems the `so` from the `Androidhive-test` directories is being picked up. – Emmanuel Jan 04 '15 at 00:31
  • OK - and the exclusion line I have is only excluding the .so file from a different directory? – Laurent Jan 04 '15 at 00:41
  • By the way - I tried to delete those two .so files manually before posting, but they reappear. So I'm not sure if they're 'getting picked up' or if they're getting generated because the exclusion isn't getting picked up. Looking forward to your feedback – Laurent Jan 04 '15 at 00:46
  • Sorry I do not know enough about JNI to help. – Emmanuel Jan 04 '15 at 00:50

0 Answers0