|
| 1 | +import java.io.FileInputStream |
| 2 | +import java.util.Properties |
| 3 | + |
| 4 | +plugins { |
| 5 | + id("com.android.application") |
| 6 | + // START: FlutterFire Configuration |
| 7 | + id("com.google.gms.google-services") |
| 8 | + // END: FlutterFire Configuration |
| 9 | + id("org.jetbrains.kotlin.android") |
| 10 | + id("dev.flutter.flutter-gradle-plugin") |
| 11 | +} |
| 12 | + |
| 13 | +val localProperties = Properties().apply { |
| 14 | + val localPropertiesFile = rootProject.file("local.properties") |
| 15 | + if (localPropertiesFile.exists()) { |
| 16 | + localPropertiesFile.reader(Charsets.UTF_8).use { load(it) } |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +val flutterVersionCode = localProperties.getProperty("flutter.versionCode")?.toInt() ?: 1 |
| 21 | + |
| 22 | +val flutterVersionName = localProperties.getProperty("flutter.versionName") ?: "1.0" |
| 23 | + |
| 24 | +val keystoreProperties = Properties().apply { |
| 25 | + val keystorePropertiesFile = rootProject.file("key.properties") |
| 26 | + if (keystorePropertiesFile.exists()) { |
| 27 | + FileInputStream(keystorePropertiesFile).use { load(it) } |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +android { |
| 32 | + namespace = "com.miraisoft.shiori" |
| 33 | + compileSdk = flutter.compileSdkVersion |
| 34 | + ndkVersion = flutter.ndkVersion |
| 35 | + |
| 36 | + packagingOptions { |
| 37 | + jniLibs { |
| 38 | + useLegacyPackaging = true |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + compileOptions { |
| 43 | + // Flag to enable support for the new language APIs |
| 44 | + isCoreLibraryDesugaringEnabled = true |
| 45 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 46 | + targetCompatibility = JavaVersion.VERSION_11 |
| 47 | + } |
| 48 | + |
| 49 | + kotlinOptions { |
| 50 | + jvmTarget = JavaVersion.VERSION_11.toString() |
| 51 | + } |
| 52 | + |
| 53 | + sourceSets { |
| 54 | + getByName("main") { |
| 55 | + java.srcDirs("src/main/kotlin") |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + // Temporary workaround as per https://issuetracker.google.com/issues/158060799 |
| 60 | + lint { |
| 61 | + disable.add("InvalidPackage") |
| 62 | + checkReleaseBuilds = false |
| 63 | + } |
| 64 | + |
| 65 | + defaultConfig { |
| 66 | + multiDexEnabled = true |
| 67 | + applicationId = "com.miraisoft.shiori" |
| 68 | + // You can update the following values to match your application needs. |
| 69 | + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. |
| 70 | + minSdk = flutter.minSdkVersion |
| 71 | + targetSdk = flutter.targetSdkVersion |
| 72 | + versionCode = flutterVersionCode |
| 73 | + versionName = flutterVersionName |
| 74 | + } |
| 75 | + |
| 76 | + signingConfigs { |
| 77 | + create("release") { |
| 78 | + keyAlias = keystoreProperties.getProperty("keyAlias") |
| 79 | + keyPassword = keystoreProperties.getProperty("keyPassword") |
| 80 | + storeFile = keystoreProperties.getProperty("storeFile")?.let { file(it) } |
| 81 | + storePassword = keystoreProperties.getProperty("storePassword") |
| 82 | + } |
| 83 | + } |
| 84 | + |
| 85 | + buildTypes { |
| 86 | + getByName("release") { |
| 87 | + signingConfig = signingConfigs.getByName("release") |
| 88 | + |
| 89 | + // Enables code shrinking, obfuscation, and optimization for only |
| 90 | + // your project's release build type. |
| 91 | + isMinifyEnabled = true |
| 92 | + |
| 93 | + // Enables resource shrinking, which is performed by the |
| 94 | + // Android Gradle plugin. |
| 95 | + isShrinkResources = true |
| 96 | + |
| 97 | + // Includes the default ProGuard rules files that are packaged with |
| 98 | + // the Android Gradle plugin. To learn more, go to the section about |
| 99 | + // R8 configuration files. |
| 100 | + proguardFiles( |
| 101 | + getDefaultProguardFile("proguard-android-optimize.txt"), |
| 102 | + "proguard-rules.pro" |
| 103 | + ) |
| 104 | + } |
| 105 | + } |
| 106 | +} |
| 107 | + |
| 108 | +flutter { |
| 109 | + source = "../.." |
| 110 | +} |
| 111 | + |
| 112 | +dependencies { |
| 113 | + implementation("androidx.annotation:annotation:1.1.0") |
| 114 | + implementation("com.jakewharton.threetenabp:threetenabp:1.2.3") |
| 115 | + |
| 116 | + // Required by the notifications plugin |
| 117 | + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4") |
| 118 | + implementation("androidx.window:window:1.0.0") |
| 119 | + implementation("androidx.window:window-java:1.0.0") |
| 120 | +} |
0 commit comments