Skip to content

Commit 7a17602

Browse files
build: add ABI-specific version code configuration
1 parent 7c2debe commit 7a17602

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

android/app/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ android {
3737
targetSdk = flutter.targetSdkVersion
3838
versionCode = flutter.versionCode
3939
versionName = flutter.versionName
40+
41+
// abiFilters cannot be present when splits abi filters are set
42+
ndk {
43+
if(!splits.abi.enable) {
44+
abiFilters 'arm64-v8a', 'armeabi-v7a'
45+
}
46+
}
4047
}
4148

4249
dependencies {
@@ -70,4 +77,16 @@ android {
7077

7178
flutter {
7279
source = "../.."
80+
}
81+
82+
// ABI-specific version code configuration
83+
ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3]
84+
import com.android.build.OutputFile
85+
android.applicationVariants.all { variant ->
86+
variant.outputs.each { output ->
87+
def abiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
88+
if (abiVersionCode != null) {
89+
output.versionCodeOverride = variant.versionCode + abiVersionCode
90+
}
91+
}
7392
}

0 commit comments

Comments
 (0)