Android : Android Gradle picking up prebuilt .so Library for a specific flavor

on Friday, March 20, 2015


My problem is picking up a specific prebuilt .so files from jniLibs or libs folder to be added in a specific productFlavors when packaging the APK.


I am using eclipse and command line to compile and assemble the codes.


Project Structure



/Projectroot
---/src
---/assets
---/res
---/jni
---/libs
---/flavor
----/flavor1
-------/jniLibs (prebuilt .so)
----/flavor2


Here is my gradle script sample



build.gradle

productFlavors {
productFlavor1 {
jniLibs.srcDirs = ['flavor1/jniLibs']
}
productFlavor2 {
}
}

buildTypes {
debug {
}
release {
}
}


So the final result would be each variants of APKs has different .so library dependecy.


0 comments:

Post a Comment