68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
import java.util.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")
|
||
}
|
||
|
||
// 加载正式签名配置
|
||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||
val keystoreProperties = Properties()
|
||
if (keystorePropertiesFile.exists()) {
|
||
keystoreProperties.load(keystorePropertiesFile.inputStream())
|
||
}
|
||
|
||
android {
|
||
namespace = "com.datalumina.YYA"
|
||
compileSdk = flutter.compileSdkVersion
|
||
ndkVersion = flutter.ndkVersion
|
||
|
||
compileOptions {
|
||
sourceCompatibility = JavaVersion.VERSION_17
|
||
targetCompatibility = JavaVersion.VERSION_17
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||
}
|
||
|
||
defaultConfig {
|
||
applicationId = "com.datalumina.YYA"
|
||
minSdk = flutter.minSdkVersion
|
||
targetSdk = flutter.targetSdkVersion
|
||
versionCode = flutter.versionCode
|
||
versionName = flutter.versionName
|
||
}
|
||
|
||
// 正式签名配置:key.properties 不存在时回退到 debug keystore,仅用于本地 release 测试
|
||
signingConfigs {
|
||
create("release") {
|
||
if (keystorePropertiesFile.exists()) {
|
||
keyAlias = keystoreProperties.getProperty("keyAlias")
|
||
keyPassword = keystoreProperties.getProperty("keyPassword")
|
||
storeFile = keystoreProperties.getProperty("storeFile")?.let { path ->
|
||
file(path)
|
||
}
|
||
storePassword = keystoreProperties.getProperty("storePassword")
|
||
} else {
|
||
keyAlias = "androiddebugkey"
|
||
keyPassword = "android"
|
||
storeFile = file("${System.getProperty("user.home")}/.android/debug.keystore")
|
||
storePassword = "android"
|
||
}
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
signingConfig = signingConfigs.getByName("release")
|
||
}
|
||
}
|
||
}
|
||
|
||
flutter {
|
||
source = "../.."
|
||
}
|