Files
PiliPlus/android/app/build.gradle.kts
dom fefb5c837b build
Signed-off-by: dom <githubaccount56556@proton.me>
2026-03-07 15:05:57 +08:00

86 lines
2.4 KiB
Kotlin

import com.android.build.gradle.internal.api.ApkVariantOutputImpl
import org.jetbrains.kotlin.konan.properties.Properties
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.example.piliplus"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
applicationId = "com.example.piliplus"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
packagingOptions.jniLibs.useLegacyPackaging = true
val keyProperties = Properties().also {
val properties = rootProject.file("key.properties")
if (properties.exists())
it.load(properties.inputStream())
}
val config = keyProperties.getProperty("storeFile")?.let {
signingConfigs.create("release") {
storeFile = file(it)
storePassword = keyProperties.getProperty("storePassword")
keyAlias = keyProperties.getProperty("keyAlias")
keyPassword = keyProperties.getProperty("keyPassword")
enableV1Signing = true
enableV2Signing = true
}
}
buildTypes {
all {
signingConfig = config ?: signingConfigs["debug"]
}
release {
if (project.hasProperty("dev")) {
applicationIdSuffix = ".dev"
resValue(
type = "string",
name = "app_name",
value = "PiliPlus dev",
)
}
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
debug {
applicationIdSuffix = ".debug"
}
}
applicationVariants.all {
val variant = this
variant.outputs.forEach { output ->
(output as ApkVariantOutputImpl).versionCodeOverride = flutter.versionCode
}
}
}
flutter {
source = "../.."
}