main
kts 79 lines 2.55 KB
Raw
1 import java.util.Properties
2 import java.io.FileInputStream
3
4 plugins {
5 id("com.android.application")
6 // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
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 = "pro.momin.localmind"
18 compileSdk = flutter.compileSdkVersion
19 ndkVersion = flutter.ndkVersion
20
21 compileOptions {
22 isCoreLibraryDesugaringEnabled = true
23 sourceCompatibility = JavaVersion.VERSION_17
24 targetCompatibility = JavaVersion.VERSION_17
25 }
26
27 kotlinOptions {
28 jvmTarget = JavaVersion.VERSION_17.toString()
29 }
30
31 defaultConfig {
32 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
33 applicationId = "pro.momin.localmind"
34 // You can update the following values to match your application needs.
35 // For more information, see: https://flutter.dev/to/review-gradle-config.
36 minSdk = 26
37 targetSdk = flutter.targetSdkVersion
38 versionCode = flutter.versionCode
39 versionName = flutter.versionName
40 multiDexEnabled = true
41 }
42
43 signingConfigs {
44 if (keystorePropertiesFile.exists()) {
45 create("release") {
46 keyAlias = keystoreProperties["keyAlias"] as String
47 keyPassword = keystoreProperties["keyPassword"] as String
48 storeFile = keystoreProperties["storeFile"]?.let { file(it) }
49 storePassword = keystoreProperties["storePassword"] as String
50 }
51 }
52 }
53
54 buildTypes {
55 release {
56 // Use the release signing config when key.properties is provided,
57 // otherwise fall back to the debug signing config so contributors
58 // without a keystore can still build the project.
59 signingConfig = if (keystorePropertiesFile.exists())
60 signingConfigs.getByName("release")
61 else
62 signingConfigs.getByName("debug")
63 isMinifyEnabled = true
64 isShrinkResources = true
65 proguardFiles(
66 getDefaultProguardFile("proguard-android-optimize.txt"),
67 "proguard-rules.pro"
68 )
69 }
70 }
71 }
72
73 flutter {
74 source = "../.."
75 }
76
77 dependencies {
78 coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
79 }