1+ import java.io.FileInputStream
2+ import java.util.Properties
3+
14plugins {
25 id(" com.android.application" )
36 id(" kotlin-android" )
47 // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
58 id(" dev.flutter.flutter-gradle-plugin" )
69}
710
11+ val keystoreProperties = Properties ()
12+ val keystorePropertiesFile = rootProject.file(" key.properties" )
13+ if (keystorePropertiesFile.exists()) {
14+ FileInputStream (keystorePropertiesFile).use { keystoreProperties.load(it) }
15+ }
16+
817android {
918 namespace = " dev.linwood.vulpine"
1019 compileSdk = flutter.compileSdkVersion
@@ -20,47 +29,48 @@ android {
2029 }
2130
2231 defaultConfig {
23- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
2432 applicationId = " dev.linwood.vulpine"
25- // You can update the following values to match your application needs.
26- // For more information, see: https://flutter.dev/to/review-gradle-config.
2733 minSdk = flutter.minSdkVersion
2834 targetSdk = flutter.targetSdkVersion
2935 versionCode = flutter.versionCode
3036 versionName = flutter.versionName
3137 }
32- productFlavors {
33- production {
34- dimension " default"
35- applicationIdSuffix " "
36- manifestPlaceholders = [appName: " Vulpine" ]
38+
39+ flavorDimensions + = " default"
40+ productFlavors {
41+ create(" production" ) {
42+ dimension = " default"
43+ applicationIdSuffix = " "
44+ manifestPlaceholders[" appName" ] = " Vulpine"
3745 }
38- development {
39- dimension " default"
40- applicationIdSuffix " "
41- manifestPlaceholders = [ appName: " Vulpine Nightly" ]
46+ create( " development" ) {
47+ dimension = " default"
48+ applicationIdSuffix = " "
49+ manifestPlaceholders[ " appName" ] = " Vulpine Nightly"
4250 }
43- nightly {
44- dimension " default"
45- applicationIdSuffix " .nightly"
46- manifestPlaceholders = [ appName: " Vulpine Nightly" ]
51+ create( " nightly" ) {
52+ dimension = " default"
53+ applicationIdSuffix = " .nightly"
54+ manifestPlaceholders[ " appName" ] = " Vulpine Nightly"
4755 }
4856 }
57+
4958 signingConfigs {
50- release {
51- keyAlias keystoreProperties[' keyAlias' ]
52- keyPassword keystoreProperties[' keyPassword' ]
53- storeFile keystoreProperties[' storeFile' ] ? file(keystoreProperties[ ' storeFile ' ]) : null
54- storePassword keystoreProperties[' storePassword' ]
59+ create( " release" ) {
60+ keyAlias = keystoreProperties[" keyAlias" ] as String?
61+ keyPassword = keystoreProperties[" keyPassword" ] as String?
62+ storeFile = keystoreProperties[" storeFile" ]?. let { file(it as String ) }
63+ storePassword = keystoreProperties[" storePassword" ] as String?
5564 }
5665 }
66+
5767 buildTypes {
58- release {
59- // Signing with the debug keys for now, so `flutter run --release` works.
60- if (keystorePropertiesFile.exists()) {
61- signingConfig signingConfigs.release
68+ getByName( " release" ) {
69+ // Use your release keystore if available, fall back to debug key
70+ signingConfig = if (keystorePropertiesFile.exists()) {
71+ signingConfigs.getByName( " release" )
6272 } else {
63- signingConfig signingConfigs.debug
73+ signingConfigs.getByName( " debug" )
6474 }
6575 }
6676 }
0 commit comments