67 lines
2.0 KiB
Kotlin
67 lines
2.0 KiB
Kotlin
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")
|
||
}
|
||
// 🔐 加载 key.properties
|
||
val keystoreProperties = Properties()
|
||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||
if (keystorePropertiesFile.exists()) {
|
||
keystoreProperties.load(keystorePropertiesFile.inputStream())
|
||
}
|
||
|
||
android {
|
||
namespace = "com.company.myapp2"
|
||
compileSdk = flutter.compileSdkVersion
|
||
ndkVersion = "28.1.13356709"
|
||
|
||
// 使用 JDK 17 / JavaVersion.VERSION_17(推荐与 AGP 8.9.x 兼容)
|
||
compileOptions {
|
||
sourceCompatibility = JavaVersion.VERSION_17
|
||
targetCompatibility = JavaVersion.VERSION_17
|
||
}
|
||
|
||
kotlinOptions {
|
||
// jvmTarget 要与 Java 版本一致
|
||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||
}
|
||
|
||
defaultConfig {
|
||
applicationId = "com.company.myapp2"
|
||
minSdk = 24
|
||
targetSdk = flutter.targetSdkVersion
|
||
versionCode = flutter.versionCode
|
||
versionName = flutter.versionName
|
||
}
|
||
|
||
signingConfigs {
|
||
create("release") {
|
||
storeFile = file(keystoreProperties["storeFile"] as String)
|
||
storePassword = keystoreProperties["storePassword"] as String
|
||
keyAlias = keystoreProperties["keyAlias"] as String
|
||
keyPassword = keystoreProperties["keyPassword"] as String
|
||
}
|
||
// debug signingConfig 通常存在(Android Gradle 会有默认 debug 签名)
|
||
// 如果你自定义 debug 签名,则可以在这里创建
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
signingConfig = signingConfigs.getByName("release")
|
||
isMinifyEnabled = false
|
||
isShrinkResources = false
|
||
}
|
||
debug {
|
||
// 使用默认 debug 签名(或你自定义的 debug)
|
||
// signingConfig = signingConfigs.getByName("debug")
|
||
}
|
||
}
|
||
}
|
||
|
||
flutter {
|
||
source = "../.."
|
||
}
|