答案 0 :(得分:2)
从您的build.gradle
,我们可能能够准确地知道要做什么。
我已使用productFlavours
与flavorDimensions
结合使用来实现可能包含或不包含jni库的构建。
根据我的理解,它的主旨是:productFlavors
使您能够拥有x,y ...类型的n个变体,添加flavorDimensions
将使您能够拥有xy类型的n个变体。
EG。在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"
}
}
}
如您所见,您将拥有多种构建变体,产品风格取决于flavorDimension
。
prod
flavor将是一个构建变体或构建类型,它只是排除了所有本机库
主题来源ndk,jniLibs,buildFlavours ......:
- Mastering "Product Flavors" on Android
- ndk-with-android-studio
- multi flavor setup