160 lines
5.0 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
// throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.aliyun.ams.emas-services' // 引用emas-services插件
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
signingConfigs {
pre {
storeFile file("starlock.keystore")
storePassword '123456'
keyAlias = 'starlock'
keyPassword '123456'
}
sky {
// CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
storeFile file("sky.jks")
storePassword 'sky2028'
keyAlias = 'upload'
keyPassword 'sky2028'
}
xhj {
storeFile file("xhj.jks")
storePassword 'xhj8872'
keyAlias = 'upload'
keyPassword 'xhj8872'
}
}
// ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) -----
flavorDimensions "flavor-type"
productFlavors {
dev {
dimension "flavor-type"
applicationId "com.starlock.lock.dev"
resValue "string", "app_name", "星锁-dev"
}
pre {
dimension "flavor-type"
applicationId "com.starlock.lock.pre"
resValue "string", "app_name", "星锁"
}
sky {
dimension "flavor-type"
applicationId "com.skychip.lock"
signingConfig signingConfigs.sky
resValue "string", "app_name", "锁通通"
}
xhj {
dimension "flavor-type"
applicationId "com.xhjcn.lock"
signingConfig signingConfigs.xhj
resValue "string", "app_name", "鑫锁"
}
}
// ----- END flavorDimensions (autogenerated by flutter_flavorizr) -----
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
lintOptions{
checkReleaseBuilds false
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "cn.starlock.lock"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
// minSdkVersion flutter.minSdkVersion
// targetSdkVersion flutter.targetSdkVersion
minSdkVersion 25
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
signingConfig signingConfigs.pre
// 为减少体积,使用不同架构分包发布编译选项 flutter build apk --split-per-abi
// 所以需要禁用ndk在同一个个包中包含多个架构
// 但是禁用NDK配置又无法使用flutter run 命令了,因为编译完成它按照名称匹配找不到.apk包
ndk {
//设置支持的SO库架构开发者可以根据需要选择一个或多个平台的so
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
}
splits {
abi {
enable true
reset()
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a
include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
universalApk true
}
}
}
buildTypes {
release {
productFlavors.dev.signingConfig signingConfigs.pre
productFlavors.pre.signingConfig signingConfigs.pre
productFlavors.sky.signingConfig signingConfigs.sky
productFlavors.xhj.signingConfig signingConfigs.xhj
}
debug {
signingConfig signingConfigs.pre
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation('com.amap.api:location:5.6.0')
implementation('com.amap.api:3dmap:8.1.0')
implementation 'com.aliyun.ams:alicloud-android-push:3.1.9.1'
}