diff --git a/android/app/build.gradle b/android/app/build.gradle index c1e12fb..27898e0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -4,6 +4,8 @@ plugins { id "dev.flutter.flutter-gradle-plugin" } +ext.abiCodes = ["armeabi-v7a": 1, "arm64-v8a": 2, "x86_64": 3] + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -33,6 +35,15 @@ android { compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion + splits{ + abi { + reset() + include 'armeabi-v7a', 'arm64-v8a', 'x86_64' + enable true + universalApk true + } + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -68,7 +79,25 @@ android { buildTypes { release { + ndk { + abiFilters "armeabi-v7a", "arm64-v8a", "x86_64" + } signingConfig signingConfigs.release + applicationVariants.all { variant -> + variant.outputs.all { output -> + def abi = output.getFilter(com.android.build.OutputFile.ABI) + if (abi != null) { + outputFileName = "pixes-${variant.versionName}-${abi}.apk" + def abiVersionCode = project.ext.abiCodes.get(abi) + if (abiVersionCode != null) { + versionCodeOverride = variant.versionCode * 10 + abiVersionCode + } + } else { + outputFileName = "pixes-${variant.versionName}.apk" + versionCodeOverride = variant.versionCode * 10 + } + } + } } } }