Browse Source
refactor: Migrate Android app's Gradle build script from Kotlin DSL to Groovy DSL
Develop_Gopal
refactor: Migrate Android app's Gradle build script from Kotlin DSL to Groovy DSL
Develop_Gopal
2 changed files with 53 additions and 80 deletions
@ -0,0 +1,53 @@ |
|||||
|
plugins { |
||||
|
id "com.android.application" |
||||
|
id "kotlin-android" |
||||
|
id "dev.flutter.flutter-gradle-plugin" |
||||
|
} |
||||
|
|
||||
|
def keystoreProperties = new Properties() |
||||
|
def keystorePropertiesFile = rootProject.file("keystore.properties") |
||||
|
if (keystorePropertiesFile.exists()) { |
||||
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) |
||||
|
} |
||||
|
|
||||
|
android { |
||||
|
namespace "com.example.hadi_hoda_flutter" |
||||
|
compileSdk 36 |
||||
|
ndkVersion flutter.ndkVersion |
||||
|
|
||||
|
compileOptions { |
||||
|
sourceCompatibility JavaVersion.VERSION_1_8 |
||||
|
targetCompatibility JavaVersion.VERSION_1_8 |
||||
|
} |
||||
|
|
||||
|
kotlinOptions { |
||||
|
jvmTarget = "1.8" |
||||
|
} |
||||
|
|
||||
|
defaultConfig { |
||||
|
applicationId "com.example.hadi_hoda_flutter" |
||||
|
minSdk 24 |
||||
|
targetSdk 36 |
||||
|
versionCode flutter.versionCode.toInteger() |
||||
|
versionName flutter.versionName |
||||
|
} |
||||
|
|
||||
|
signingConfigs { |
||||
|
release { |
||||
|
keyAlias keystoreProperties['keyAlias'] |
||||
|
keyPassword keystoreProperties['keyPassword'] |
||||
|
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null |
||||
|
storePassword keystoreProperties['storePassword'] |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
buildTypes { |
||||
|
release { |
||||
|
signingConfig signingConfigs.release |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
flutter { |
||||
|
source "../.." |
||||
|
} |
||||
@ -1,80 +0,0 @@ |
|||||
import kotlin.text.all |
|
||||
import kotlin.text.find |
|
||||
import kotlin.text.isNotEmpty |
|
||||
import kotlin.text.replace |
|
||||
import java.io.FileInputStream |
|
||||
import java.util.Properties |
|
||||
|
|
||||
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") |
|
||||
} |
|
||||
|
|
||||
def keystoreProperties = new Properties() |
|
||||
def keystorePropertiesFile = rootProject.file('keystore.properties') |
|
||||
if (keystorePropertiesFile.exists()) { |
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) |
|
||||
} |
|
||||
|
|
||||
android { |
|
||||
namespace = "com.example.hadi_hoda_flutter" |
|
||||
compileSdk = 36 |
|
||||
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 = 24 |
|
||||
targetSdk = 36 |
|
||||
versionCode = flutter.versionCode |
|
||||
versionName = flutter.versionName |
|
||||
} |
|
||||
|
|
||||
signingConfigs { |
|
||||
create("release") { |
|
||||
keyAlias = keystoreProperties['keyAlias'] |
|
||||
keyPassword = keystoreProperties['keyPassword'] |
|
||||
storeFile = file(keystoreProperties['storeFile']) |
|
||||
storePassword = keystoreProperties['storePassword'] |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
buildTypes { |
|
||||
release { |
|
||||
signingConfig = signingConfigs.getByName("release") |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
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 = "../.." |
|
||||
} |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue