|
| 1 | +import java.util.Properties |
| 2 | +import java.io.FileInputStream |
| 3 | + |
| 4 | +plugins { |
| 5 | + id("com.android.application") |
| 6 | + id("kotlin-android") |
| 7 | + id("dev.flutter.flutter-gradle-plugin") |
| 8 | +} |
| 9 | + |
| 10 | +val keystoreProperties = Properties() |
| 11 | +val keystorePropertiesFile = rootProject.file("key.properties") |
| 12 | +if (keystorePropertiesFile.exists()) { |
| 13 | + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) |
| 14 | +} |
| 15 | + |
| 16 | +android { |
| 17 | + namespace = "com.example.verygoodcore.marvel" |
| 18 | + compileSdk = flutter.compileSdkVersion |
| 19 | + ndkVersion = flutter.ndkVersion |
| 20 | + |
| 21 | + compileOptions { |
| 22 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 23 | + targetCompatibility = JavaVersion.VERSION_11 |
| 24 | + } |
| 25 | + |
| 26 | + kotlinOptions { |
| 27 | + jvmTarget = JavaVersion.VERSION_11.toString() |
| 28 | + } |
| 29 | + |
| 30 | + defaultConfig { |
| 31 | + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). |
| 32 | + applicationId = "com.example.verygoodcore.marvel" |
| 33 | + // You can update the following values to match your application needs. |
| 34 | + // For more information, see: https://flutter.dev/to/review-gradle-config. |
| 35 | + minSdk = flutter.minSdkVersion |
| 36 | + targetSdk = flutter.targetSdkVersion |
| 37 | + versionCode = flutter.versionCode |
| 38 | + versionName = flutter.versionName |
| 39 | + |
| 40 | + ndkVersion = "27.0.12077973" |
| 41 | + } |
| 42 | + |
| 43 | + signingConfigs { |
| 44 | + create("release") { |
| 45 | + if (System.getenv("ANDROID_KEYSTORE_PATH") != null) { |
| 46 | + storeFile = file(System.getenv("ANDROID_KEYSTORE_PATH")) |
| 47 | + keyAlias = System.getenv("ANDROID_KEYSTORE_ALIAS") |
| 48 | + keyPassword = System.getenv("ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD") |
| 49 | + storePassword = System.getenv("ANDROID_KEYSTORE_PASSWORD") |
| 50 | + |
| 51 | + } else { |
| 52 | + keyAlias = keystoreProperties["keyAlias"] as String? |
| 53 | + keyPassword = keystoreProperties["keyPassword"] as String? |
| 54 | + storeFile = keystoreProperties["storeFile"]?.let { file(it) } |
| 55 | + storePassword = keystoreProperties["storePassword"] as String? |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + flavorDimensions += "default" |
| 61 | + productFlavors { |
| 62 | + create("production") { |
| 63 | + dimension = "default" |
| 64 | + applicationIdSuffix = "" |
| 65 | + manifestPlaceholders["appName"] = "Marvel" |
| 66 | + } |
| 67 | + create("staging") { |
| 68 | + dimension = "default" |
| 69 | + applicationIdSuffix = ".stg" |
| 70 | + manifestPlaceholders["appName"] = "[STG] Marvel" |
| 71 | + } |
| 72 | + create("development") { |
| 73 | + dimension = "default" |
| 74 | + applicationIdSuffix = ".dev" |
| 75 | + manifestPlaceholders["appName"] = "[DEV] Marvel" |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + buildTypes { |
| 80 | + getByName("release") { |
| 81 | + signingConfig = signingConfigs.getByName("release") |
| 82 | + isMinifyEnabled = true |
| 83 | + proguardFiles( |
| 84 | + getDefaultProguardFile("proguard-android.txt"), |
| 85 | + "proguard-rules.pro" |
| 86 | + ) |
| 87 | + } |
| 88 | + getByName("debug") { |
| 89 | + signingConfig = signingConfigs.getByName("debug") |
| 90 | + } |
| 91 | + } |
| 92 | +} |
| 93 | + |
| 94 | +flutter { |
| 95 | + source = "../.." |
| 96 | +} |
| 97 | + |
| 98 | +dependencies { |
| 99 | + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20") |
| 100 | +} |
0 commit comments