Files
PiliPlus/android/app/build.gradle.kts
bggRGjQaUbCoE 2d625e0241 fix android build
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-09-18 18:08:24 +08:00

78 lines
2.1 KiB
Plaintext

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 {
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 = "../.."
}