初始化项目

This commit is contained in:
wyf
2025-04-11 08:47:46 +08:00
parent e0e1055d65
commit 9396f18d09
199 changed files with 6516 additions and 216 deletions

View File

@@ -5,40 +5,103 @@ plugins {
id "dev.flutter.flutter-gradle-plugin"
}
android {
namespace = "com.example.vbvs_app"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def versionProperties = new Properties()
def versionPropertiesFile = rootProject.file("version.properties")
if (versionPropertiesFile.exists()) {
versionProperties.load(new FileInputStream(versionPropertiesFile))
}
def flutterVersionCode = versionProperties.getProperty("flutter.android.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "5"
}
def flutterVersionName = versionProperties.getProperty("flutter.android.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0.4"
}
android {
namespace = "com.taihe.vbvs_app"
// compileSdk = flutter.compileSdkVersion
compileSdk = localProperties.getProperty('flutter.compileSdkVersion').toInteger()
// ndkVersion = flutter.ndkVersion
ndkVersion = localProperties.getProperty('flutter.ndkVersion')
// 编译的jvm版本
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// 指定Kotilin的jvm版本
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.vbvs_app"
applicationId "com.taihe.vbvs_app"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
// minSdk = flutter.minSdkVersion
// targetSdk = flutter.targetSdkVersion
minSdk = localProperties.getProperty('flutter.minSdkVersion').toInteger()
targetSdk = localProperties.getProperty('flutter.targetSdkVersion').toInteger()
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
debuggable false
minifyEnabled true//是否启动混淆 ture:打开 false:关闭
shrinkResources true //删除无用资源(压缩)
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.debug
// signingConfig = signingConfigs.debug
signingConfig signingConfigs.release
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "ZHMHT_v${variant.versionName}-${releaseTime()}.apk"
}
}
}
debug {
debuggable true
signingConfig signingConfigs.release
}
}
}
static def releaseTime() {
return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
}
flutter {
source = "../.."
}