1+ import java.util.Properties
2+
13plugins {
2- id " com.android.application"
3- id " kotlin-android"
4+ id( " com.android.application" )
5+ id( " kotlin-android" )
46 // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5- id " dev.flutter.flutter-gradle-plugin"
7+ id( " dev.flutter.flutter-gradle-plugin" )
68}
79
810// custom: load signing keys
9- def keystoreProperties = new Properties ()
10- def keystorePropertiesFile = rootProject. file(' key.properties' )
11+ val keystoreProperties = Properties ()
12+ val keystorePropertiesFile = rootProject.file(" key.properties" )
1113if (keystorePropertiesFile.exists()) {
12- keystoreProperties. load(new FileInputStream ( keystorePropertiesFile))
14+ keystoreProperties.load(keystorePropertiesFile.inputStream( ))
1315}
1416
1517android {
1618 namespace = " com.example.synctube"
1719 compileSdk = flutter.compileSdkVersion
18- // ndkVersion = flutter.ndkVersion
20+ ndkVersion = flutter.ndkVersion
1921 // temp fix for this error:
2022 // Your project is configured with Android NDK 23.1.7779620, but the following plugin(s) depend on a different Android NDK version:
21- ndkVersion = " 27.0.12077973"
23+ // ndkVersion = "27.0.12077973"
2224
2325 compileOptions {
24- coreLibraryDesugaringEnabled true
26+ isCoreLibraryDesugaringEnabled = true
2527 sourceCompatibility = JavaVersion .VERSION_17
2628 targetCompatibility = JavaVersion .VERSION_17
2729 }
2830
29- dependencies {
30- coreLibraryDesugaring ' com.android.tools:desugar_jdk_libs:2.1.4'
31- }
32-
3331 kotlinOptions {
34- jvmTarget = JavaVersion . VERSION_17
32+ jvmTarget = JavaVersion .VERSION_17 .toString()
3533 }
3634
3735 defaultConfig {
@@ -40,34 +38,48 @@ android {
4038 // You can update the following values to match your application needs.
4139 // For more information, see: https://flutter.dev/to/review-gradle-config.
4240 // minSdk = flutter.minSdkVersion
43- minSdk = 21
41+ minSdk = flutter.minSdkVersion
4442 targetSdk = flutter.targetSdkVersion
4543 versionCode = flutter.versionCode
4644 versionName = flutter.versionName
4745 }
4846
4947 // custom: config
5048 signingConfigs {
51- release {
52- keyAlias keystoreProperties[' keyAlias' ]
53- keyPassword keystoreProperties[' keyPassword' ]
54- storeFile keystorePropertiesFile. exists() ? file(keystoreProperties[' storeFile' ]) : null
55- storePassword keystoreProperties[' storePassword' ]
49+ create(" release" ) {
50+ keyAlias = keystoreProperties[" keyAlias" ] as String?
51+ keyPassword = keystoreProperties[" keyPassword" ] as String?
52+ storeFile = if (keystorePropertiesFile.exists()) {
53+ file(keystoreProperties[" storeFile" ] as String )
54+ } else null
55+ storePassword = keystoreProperties[" storePassword" ] as String?
5656 }
5757 }
5858
5959 buildTypes {
6060 debug {
61- signingConfig = keystorePropertiesFile. exists() ? signingConfigs. release : signingConfigs. debug
61+ signingConfig = if (keystorePropertiesFile.exists()) {
62+ signingConfigs.getByName(" release" )
63+ } else {
64+ signingConfigs.getByName(" debug" )
65+ }
6266 }
6367 release {
6468 // TODO: Add your own signing config for the release build.
6569 // Signing with the debug keys for now, so `flutter run --release` works.
66- signingConfig = keystorePropertiesFile. exists() ? signingConfigs. release : signingConfigs. debug
70+ signingConfig = if (keystorePropertiesFile.exists()) {
71+ signingConfigs.getByName(" release" )
72+ } else {
73+ signingConfigs.getByName(" debug" )
74+ }
6775 }
6876 }
6977}
7078
79+ dependencies {
80+ coreLibraryDesugaring(" com.android.tools:desugar_jdk_libs:2.1.4" )
81+ }
82+
7183flutter {
7284 source = " ../.."
7385}
0 commit comments