From your build.gradle we can find out what needs to be done exactly.
I used productFlavours in combination with flavorDimensions to implement assemblies that may or may not include jni libraries.
From what I understand, the gist of this is: productFlavors allows you to have n variants of x, y ... type, adding flavorDimensions will allow you to have n variants of xy type.
Eg. Inside build.gradle ,
flavorDimensions "abi", "version" //this is what can help you build with/w/o jni libraries productFlavors { devel { flavorDimension "abi" //keep a dimension common with arm, armv7 applicationId "com.packagename.dev" } prod { flavorDimension "version" // this would be your build w/o the ndk support then applicationId "com.packageName" } armv7 { ndk { flavorDimension "abi" abiFilter "armeabi-v7a" } } arm { ndk { flavorDimension "abi" abiFilter "armeabi" } } }
As you can see, you will have several build options, product tastes depending on flavorDimension .
prod flavor will be a build option or build type that just excludes all native libraries
Sources for ndk, jniLibs, buildFlavours ... themes:
- Mastering "Product Flavors" on Android
- ndk-with-android-studio
- setting multiple flavors
source share