|
| 1 | +import java.util.Properties |
| 2 | +import java.io.FileInputStream |
| 3 | + |
| 4 | +plugins { |
| 5 | + id("com.android.application") |
| 6 | + id("kotlin-android") |
| 7 | + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. |
| 8 | + id("dev.flutter.flutter-gradle-plugin") |
| 9 | +} |
| 10 | + |
| 11 | +val keystoreProperties = Properties() |
| 12 | +val keystorePropertiesFile = rootProject.file("release.properties") |
| 13 | +if (keystorePropertiesFile.exists()) { |
| 14 | + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) |
| 15 | +} |
| 16 | + |
| 17 | +if (System.getenv()["CI"] != null) { // CI=true is exported by Codemagic |
| 18 | + keystoreProperties["keyAlias"] = System.getenv()["FCI_KEY_ALIAS"] |
| 19 | + keystoreProperties["keyPassword"] = System.getenv()["FCI_KEY_PASSWORD"] |
| 20 | + keystoreProperties["storeFile"] = file(System.getenv()["FCI_BUILD_DIR"] + "/keystore.jks") |
| 21 | + keystoreProperties["storePassword"] = System.getenv()["FCI_KEYSTORE_PASSWORD"] |
| 22 | +} |
| 23 | + |
| 24 | +android { |
| 25 | + namespace = "com.kurtlourens.no_mans_sky_recipes" |
| 26 | + compileSdk = flutter.compileSdkVersion |
| 27 | + // ndkVersion = flutter.ndkVersion |
| 28 | + ndkVersion = "27.0.12077973" |
| 29 | + |
| 30 | + compileOptions { |
| 31 | + isCoreLibraryDesugaringEnabled = true |
| 32 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 33 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 34 | + } |
| 35 | + |
| 36 | + kotlinOptions { |
| 37 | + jvmTarget = JavaVersion.VERSION_1_8.toString() |
| 38 | + } |
| 39 | + |
| 40 | + dexOptions { |
| 41 | + preDexLibraries = false |
| 42 | + incremental = true |
| 43 | + javaMaxHeapSize = "4g" |
| 44 | + } |
| 45 | + |
| 46 | + defaultConfig { |
| 47 | + applicationId = "com.kurtlourens.no_mans_sky_recipes" |
| 48 | + // minSdk = flutter.minSdkVersion |
| 49 | + minSdk = 25 |
| 50 | + targetSdk = flutter.targetSdkVersion |
| 51 | + versionCode = flutter.versionCode |
| 52 | + versionName = flutter.versionName |
| 53 | + multiDexEnabled = true |
| 54 | + } |
| 55 | + |
| 56 | + signingConfigs { |
| 57 | + create("release") { |
| 58 | + keyAlias = keystoreProperties["keyAlias"] as String |
| 59 | + keyPassword = keystoreProperties["keyPassword"] as String |
| 60 | + storeFile = keystoreProperties["storeFile"]?.let { file(it) } |
| 61 | + storePassword = keystoreProperties["storePassword"] as String |
| 62 | + } |
| 63 | + } |
| 64 | + |
| 65 | + buildTypes { |
| 66 | + release { |
| 67 | + signingConfig = signingConfigs.getByName("debug") |
| 68 | + signingConfig = signingConfigs.getByName("release") |
| 69 | + } |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +dependencies { |
| 74 | + // https://stackoverflow.com/questions/79158012/dependency-flutter-local-notifications-requires-core-library-desugaring-to-be |
| 75 | + // and https://mvnrepository.com/artifact/com.android.tools/desugar_jdk_libs |
| 76 | + // and https://developer.android.com/studio/write/java8-support#library-desugaring |
| 77 | + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") |
| 78 | +} |
| 79 | + |
| 80 | +flutter { |
| 81 | + source = "../.." |
| 82 | +} |
0 commit comments