I need to filter my 3-rd party native libraries and allow only "armeabi" for all of them. With one exception! - a specific library must be included in its "armeabi-v7a" variant.
How can I filter my 3rd party native libraries differently depending on the library? (or on the app module)
What I want in my APK in the end is:
- armeabi / lib-1.so
- armeabi / lib-2.so
- armeabi / lib-3.so
- armeabi-v7a / special-lib.so
The full story:
I have an app built in a couple of modules. It uses a few 3rd party native libraries. Until now, we were only using "armeabi" versions of all libraries, since they are most compatible, and since we aim for low app size (without multiple APK's). However, now we need to include a new 3rd party library that is only available in "armeabi-v7a" form.
We've been using the filter:
productFlavors {
app {
ndk {
abiFilters "armeabi"
}}}
It's located in the main app module. It filters all native libraries from all modules and libraries. Now we are forced to use this filter:
productFlavors {
app {
ndk {
abiFilters "armeabi", "armeabi-v7a"
}}}
Which makes the app work but also increases its size significantly. We don't want to use it. It allows the armeabi-v7a version of the new library, but it also allows the armeabi-v7a versions of a few other libraries that we don't want to include.
The question: We want to allow "armeabi-v7a" only for one specific library which resides in one of our app modules. Can we achieve that by ABI filters or some other way?
Note about 64-bit: I know that in case you have ANY 64 bit native libraries, you need to have all of them (cause if the app finds one 64-bit lib, it will start in 64-bit mode and will not be able to use the 32-bit libs). However, in the case of armeabi vs armeabi-v7a there is no such problem and you don't have to supply both versions of each lib.