import kotlin.text.all import kotlin.text.find import kotlin.text.isNotEmpty import kotlin.text.replace plugins { id("com.android.application") id("kotlin-android") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } android { namespace = "com.example.hadi_hoda_flutter" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.example.hadi_hoda_flutter" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.getByName("debug") } } applicationVariants.all { val variant = this variant.outputs.all { val output = this // Get the architecture (ABI) for the current output. Note: Flutter often uses 'armeabi-v7a', 'arm64-v8a', etc. val abi = output.filters.find { it.filterType == "ABI" }?.identifier?.replace("armeabi-", "") ?: "" // Make sure we are dealing with an APK output if (output is com.android.build.gradle.internal.api.ApkVariantOutputImpl) { // Append the ABI to the filename, with a hyphen if it exists val abiSuffix = if (abi.isNotEmpty()) "-$abi" else "" output.outputFileName = "Hadi & Hoda v${variant.versionName}+${variant.versionCode}${abiSuffix}.apk" } } } } flutter { source = "../.." }