Gradle DSL packagingOptions exclude/pickFirst not working for jniLibs

3,707 views
Skip to first unread message

Kloon

unread,
Nov 11, 2014, 8:18:31 AM11/11/14
to adt...@googlegroups.com
I have multiple native libraries included in my project which mutually contain the stlport_shared library and the DSL to exclude/pickFirst has no effect, it always results in the following error nonetheless:

Error:duplicate files during packaging of APK ***
    Path in archive: lib/armeabi/libstlport_shared.so
      Origin 1: ***\build\intermediates\exploded-aar\hu.uni_pannon.lavinia\absorptionmodel\1.0.0\jni\armeabi\libstlport_shared.so
 Origin 2: ***\src\main\jniLibs\armeabi\libstlport_shared.so
You can ignore those files in your build.gradle:
 android {
        packagingOptions {
       exclude 'lib/armeabi/libstlport_shared.so'
   }
 }

This is what I have in the build.gradle file:

android {
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'

        pickFirst 'lib/armeabi/libstlport_shared.so'
        pickFirst 'lib/armeabi-v7a/libstlport_shared.so'
        pickFirst 'lib/x86/libstlport_shared.so'
    }
}

Is this a known regression?

Xavier Ducrohet

unread,
Nov 11, 2014, 12:44:31 PM11/11/14
to adt...@googlegroups.com
It's more a limitation than a regression because it never applied to packaged libraries.

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Kloon

unread,
Nov 12, 2014, 7:23:54 AM11/12/14
to adt...@googlegroups.com
Is there an ETA for this?

resh

unread,
Jan 21, 2015, 3:35:50 PM1/21/15
to adt...@googlegroups.com
Were you able to get around this issue? Is there a fix or a workaround?

thanks!

Kloon

unread,
Jan 22, 2015, 3:00:56 AM1/22/15
to adt...@googlegroups.com
Yes, I have repackaged my private libraries to not include the STL library and moved that into a dependency so gradle can handle this.

Kloon

--
You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/QrTyUPslbwA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.

Sebastian Schuberth

unread,
Mar 6, 2015, 11:34:46 AM3/6/15
to adt...@googlegroups.com
On Tuesday, November 11, 2014 at 6:44:31 PM UTC+1, Xavier Ducrohet wrote:

It's more a limitation than a regression because it never applied to packaged libraries.


I've now filed [1] to track this.

[1] https://code.google.com/p/android/issues/detail?id=158630

Regards,
Sebastian
Reply all
Reply to author
Forward
0 new messages