Android Error: duplicate files during packaging of APK



We are trying to upgrade shinobicharts from 1.5.0-5 to 1.6.0-0 using Android Studio 0.8.9.

After removing the old version and installing the new version we are met with the following error message:


Error:duplicate files during packaging of APK /Users/matthew/Programming/wdandroid/project/build/outputs/apk/project-debug-unaligned.apk

Path in archive: lib/armeabi/

Origin 1: /Users/matthew/Programming/wdandroid/project/build/intermediates/exploded-aar/wdandroid/shinobichartsandroidlibrary/unspecified/jni/armeabi/

Origin 2: /Users/matthew/Programming/wdandroid/project/src/main/jniLibs/armeabi/

You can ignore those files in your build.gradle:

android {

 packagingOptions {

   exclude ‘lib/armeabi/’



Error:Execution failed for task ‘:project:packageDebug’.

> Duplicate files copied in APK lib/armeabi/

  File 1: /Users/matthew/Programming/wdandroid/project/build/intermediates/exploded-aar/wdandroid/shinobichartsandroidlibrary/unspecified/jni/armeabi/

  File 2: /Users/matthew/Programming/wdandroid/project/build/intermediates/exploded-aar/wdandroid/shinobichartsandroidlibrary/unspecified/jni/armeabi/

Information:BUILD FAILED

Trying to exclude the package as suggested (even though that seems like a bad idea) doesn’t resolve the error message.

We’ve been debugging this afternoon but can’t seem to make any progress. Any advice or help would be greatly appreciated!


  • Matthew


Hi Matthew,

Due to its current beta status, and frequency of change, we don’t officially support the use of our library with Android Studio. This will of course change once it is out of beta.

That said, it is possible to use our library with Android Studio and our tech evangelist Sam Davies has written a blog post on this very subject. Have you imported our library in the same manner described in that post? While the post was aimed at v0.5.5 it should still be (mostly) relevant for 0.8.9. It’s not entirely clear what’s being done from what was written above but you should add our library as a separate module to your app and make sure it is using the ‘android-library’ plugin, not the ‘android’ plugin in the build.gradle file.

Aside from that there isn’t much else I can offer. Hopefully Sam’s blog post will give you some pointers!

Kind regards,