Gradle 常用代码片段

abiFilters

NdkOptions - abiFilters

1
2
3
4
5
6
7
8
9
10
11
android {
// Similar to other properties in the defaultConfig block, you can override
// these properties for each product flavor in your build configuration.
defaultConfig {
ndk {
// Tells Gradle to build outputs for the following ABIs and package
// them into your APK.
abiFilters 'x86', 'x86_64', 'armeabi'
}
}
}

另外一种方式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
productFlavors {  
flavor1 {
ndk {
abiFilters "armeabi-v7a"
}
}
flavor2 {
ndk {
abiFilters "armeabi-v7a"
abiFilters "x86"
abiFilters "armeabi"
abiFilters "arm64-v8a"
abiFilters "x86_64"
}
}
}