add ABI split with F-Droid version code scheme
This commit is contained in:
1 parent
eaf00679f9
commit
0ceaafd43c
1 file changed
+33
@@ -1,5 +1,6 @@
|
||||
import java.util.Properties
|
||||
import java.io.FileInputStream
|
||||
import com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
@@ -13,11 +14,24 @@ if (keystorePropertiesFile.exists()) {
|
||||
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
|
||||
val enableAbiSplit = project.hasProperty("split-per-abi-fdroid")
|
||||
|
||||
android {
|
||||
namespace = "com.example.mashhad_metro"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = "27.0.12077973"
|
||||
|
||||
if(enableAbiSplit) {
|
||||
splits {
|
||||
abi {
|
||||
isEnable = true
|
||||
reset()
|
||||
include("armeabi-v7a", "arm64-v8a", "x86_64")
|
||||
isUniversalApk = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
@@ -65,6 +79,25 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
if (enableAbiSplit) {
|
||||
val abiCodes = mapOf(
|
||||
"armeabi-v7a" to 1,
|
||||
"arm64-v8a" to 2,
|
||||
"x86_64" to 3
|
||||
)
|
||||
|
||||
android.applicationVariants.configureEach {
|
||||
val variant = this
|
||||
variant.outputs.forEach { output ->
|
||||
val abiVersionCode = abiCodes[output.filters.find { it.filterType == "ABI" }?.identifier]
|
||||
if (abiVersionCode != null) {
|
||||
(output as ApkVariantOutputImpl).versionCodeOverride =
|
||||
variant.versionCode * 10 + abiVersionCode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
Reference in new issue
Block a user