app-starlock/android/app/build.gradle

372 lines
16 KiB
Groovy
Raw Normal View History

2023-07-10 17:50:31 +08:00
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.")
2023-07-10 17:50:31 +08:00
}
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'
//<com>
2025-01-10 14:57:26 +08:00
apply plugin: 'com.google.gms.google-services'
//</com>
2023-07-10 17:50:31 +08:00
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2024-04-18 16:27:56 +08:00
apply plugin: 'com.android.application'
2024-09-08 02:00:00 +08:00
//apply plugin: 'android-junk-code'
apply plugin: 'com.huawei.agconnect'
2024-09-07 20:41:09 +08:00
apply from: 'and_res_guard.gradle'
2024-04-18 16:27:56 +08:00
2024-09-08 02:00:00 +08:00
//androidJunkCode {
// variantConfig {
// release {
// //注意这里的release是变体名称如果没有设置productFlavors就是buildType名称如果有设置productFlavors就是flavor+buildType例如freeRelease、proRelease
// packageBase = "cn.hx.plugin.ui" //生成java类根包名
// packageCount = 30 //生成包数量
// activityCountPerPackage = 3 //每个包下生成Activity类数量
// excludeActivityJavaFile = false
// //是否排除生成Activity的Java文件,默认false(layout和写入AndroidManifest.xml还会执行),主要用于处理类似神策全埋点编译过慢问题
// otherCountPerPackage = 50 //每个包下生成其它类的数量
// methodCountPerClass = 20 //每个类下生成方法数量
// resPrefix = "junk_" //生成的layout、drawable、string等资源名前缀
// drawableCount = 300 //生成drawable资源数量
// stringCount = 300 //生成string数量
// }
// }
//}
2023-07-10 17:50:31 +08:00
android {
signingConfigs {
// 这里“debug”不是一个自定义变量而是一个特定的关键词凡是使用--debug模式都会引用到这里
// 目前看来debug模式没办法在buildTypes里面按flavors指定编译签名所有口味的debug模式只能用同一个签名
debug {
2024-09-07 20:41:09 +08:00
storeFile file("starlock.keystore")
storePassword '123456'
keyAlias = 'starlock'
keyPassword '123456'
// storeFile file("xhj.jks")
// storePassword 'xhj8872'
// keyAlias = 'upload'
// keyPassword 'xhj8872'
}
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'
}
xhj_bundle {
storeFile file("xhj_bundle.jks")
storePassword 'xhj8872'
keyAlias = 'xhj'
keyPassword 'xhj8872'
}
}
2024-03-22 15:53:51 +08:00
// ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) -----
flavorDimensions "flavor-type"
productFlavors {
2024-04-08 13:30:35 +08:00
local {
2024-03-22 15:53:51 +08:00
dimension "flavor-type"
2024-04-08 13:30:35 +08:00
applicationId "com.starlock.lock.local"
signingConfig signingConfigs.debug
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "Star Lock"
2024-04-08 13:30:35 +08:00
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.local"
2024-03-22 15:53:51 +08:00
}
dev {
dimension "flavor-type"
applicationId "com.starlock.lock.dev"
signingConfig signingConfigs.debug
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "Star Lock"
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.dev"
}
pre {
dimension "flavor-type"
applicationId "com.starlock.lock.pre"
signingConfig signingConfigs.debug
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "Star Lock-P"
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.pre"
}
sky {
dimension "flavor-type"
applicationId "com.skychip.lock"
signingConfig signingConfigs.sky
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "TTLock Pro"
manifestPlaceholders = [
JPUSH_PKGNAME : "com.skychip.lock",
JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",//--skyAppKey
JPUSH_CHANNEL : "flutter_channel",
XIAOMI_APPID : "MI-2882303761520287291",
XIAOMI_APPKEY : "MI-5352028744291",
OPPO_APPKEY : "OP-ccae67a4a8c1470a8350b0d6a89f8105",
OPPO_APPID : "OP-31586713",
OPPO_APPSECRET: "OP-2339389233094ca297de7b10213f7bd8",
VIVO_APPKEY : "6a18657357d176364a91f50e4c9cd7c4",
VIVO_APPID : "105724810",
HONOR_APPID : "104437184",
]
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules-sky.pro'
}
2024-09-26 09:52:23 +08:00
sky_pre {
dimension "flavor-type"
applicationId "com.skychip.lock.pre"
signingConfig signingConfigs.sky
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "TTLock Pro-P"
manifestPlaceholders.JPUSH_PKGNAME = "com.skychip.lock.pre"
2024-09-26 09:52:23 +08:00
}
sky_dev {
dimension "flavor-type"
applicationId "com.skychip.lock.dev"
signingConfig signingConfigs.sky
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "TTLock Pro"
manifestPlaceholders.JPUSH_PKGNAME = "com.skychip.lock.dev"
2024-09-26 09:52:23 +08:00
}
xhj {
dimension "flavor-type"
applicationId "com.xhjcn.lock"
signingConfig signingConfigs.xhj
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "Star Lock"
manifestPlaceholders = [
JPUSH_PKGNAME : "com.xhjcn.lock",
JPUSH_APPKEY : "251fc8074820d122b6de58d2",//--鑫泓佳AppKey
JPUSH_CHANNEL : "flutter_channel",
XIAOMI_APPID : "MI-2882303761520314939",
XIAOMI_APPKEY : "MI-5312031456939",
OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b",
OPPO_APPID : "OP-31726001",
OPPO_APPSECRET: "OP-05723986bba64183a71530b496922450",
VIVO_APPKEY : "75fe8e570425b714e08d0390b14797cb",
VIVO_APPID : "105752244",
HONOR_APPID : "104458196",
]
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules-xhj.pro'
}
xhj_bundle {
dimension "flavor-type"
applicationId "ltd.xhjcn.lock"
signingConfig signingConfigs.xhj_bundle
resValue "string", "app_name", "Star Lock"
manifestPlaceholders = [
JPUSH_PKGNAME: "ltd.xhjcn.lock",
JPUSH_APPKEY : "5ccdb9b8d3faaae66ba5d02e",
JPUSH_CHANNEL: "flutter_channel",
]
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules-xhj.pro'
}
2024-09-26 09:52:23 +08:00
xhj_pre {
dimension "flavor-type"
applicationId "com.xhjcn.lock.pre"
signingConfig signingConfigs.xhj
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "Star Lock-P"
manifestPlaceholders.JPUSH_PKGNAME = "com.xhjcn.lock.pre"
2024-09-26 09:52:23 +08:00
}
xhj_dev {
dimension "flavor-type"
applicationId "com.xhjcn.lock.dev"
signingConfig signingConfigs.xhj
2024-12-19 14:30:08 +08:00
resValue "string", "app_name", "Star Lock"
manifestPlaceholders.JPUSH_PKGNAME = "com.xhjcn.lock.dev"
2024-09-26 09:52:23 +08:00
}
}
// ----- END flavorDimensions (autogenerated by flutter_flavorizr) -----
2024-03-22 15:53:51 +08:00
compileSdkVersion flutter.compileSdkVersion
2023-07-10 17:50:31 +08:00
ndkVersion flutter.ndkVersion
2024-09-07 20:41:09 +08:00
lintOptions {
checkReleaseBuilds false
abortOnError false
}
2023-07-10 17:50:31 +08:00
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.skychip.lock"
2023-07-10 17:50:31 +08:00
// 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.
2023-08-08 09:42:35 +08:00
minSdkVersion 25
targetSdkVersion 35
2023-07-10 17:50:31 +08:00
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2023-09-28 18:05:23 +08:00
// 为减少体积,使用不同架构分包发布编译选项 flutter build apk --split-per-abi
// 所以需要禁用ndk在同一个个包中包含多个架构
// 但是禁用NDK配置又无法使用flutter run 命令了,因为编译完成它按照名称匹配找不到.apk包
2023-09-28 18:05:23 +08:00
ndk {
//设置支持的SO库架构开发者可以根据需要选择一个或多个平台的so
2024-03-28 10:33:54 +08:00
// abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
// 参考魅族平台的公告得知在2023年1月商店就可以只需要64位应用即可
// 这说明32位是很老很老的平台我们的flutter或者说我们的项目本来就兼容不了老平台架构兼容也没必要
abiFilters "arm64-v8a"
2023-09-28 18:05:23 +08:00
}
manifestPlaceholders = [
JPUSH_PKGNAME : "这里不重要,在口味配置",
//JPush 上注册的包名对应的 Appkey.
// JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",//--skyAppKey
JPUSH_APPKEY : "default",//--鑫泓佳AppKey
JPUSH_CHANNEL : "default",
//若不集成厂商通道,可直接跳过以下配置
//以下为sky的配置
// XIAOMI_APPID : "MI-2882303761520287291",
// XIAOMI_APPKEY : "MI-5352028744291",
//以下均为鑫泓佳的配置
XIAOMI_APPID : "default",
XIAOMI_APPKEY : "default",
OPPO_APPKEY : "default",
OPPO_APPID : "default",
OPPO_APPSECRET: "default",
VIVO_APPKEY : "default",
VIVO_APPID : "default",
HONOR_APPID : "default",
]
splits {
abi {
enable true
reset()
2024-03-28 10:33:54 +08:00
// 参考魅族平台的公告得知在2023年1月商店就可以只需要64位应用即可
// 这说明32位是很老很老的平台我们的flutter或者说我们的项目本来就兼容不了老平台架构兼容也没必要
// include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
// include "arm64-v8a"
universalApk false
}
2023-09-28 18:05:23 +08:00
}
}
2023-07-10 17:50:31 +08:00
buildTypes {
2024-06-17 10:52:06 +08:00
debug {
// 高德地图导致release编译模式下应用闪退根据[高德地图在Debug模式下运行正常但是打Release包时则闪退解决办法](https://blog.csdn.net/weixin_39370093/article/details/109631210)
// 为release模式设置混淆可以解决地图闪退问题
// 真实的解决办法
minifyEnabled false
shrinkResources false
2024-06-17 10:52:06 +08:00
productFlavors.local.signingConfig signingConfigs.debug
productFlavors.dev.signingConfig signingConfigs.debug
productFlavors.pre.signingConfig signingConfigs.debug
productFlavors.sky.signingConfig signingConfigs.sky
2024-12-31 14:24:58 +08:00
productFlavors.sky_dev.signingConfig signingConfigs.sky
productFlavors.sky_pre.signingConfig signingConfigs.sky
2024-06-17 10:52:06 +08:00
productFlavors.xhj.signingConfig signingConfigs.xhj
2024-12-31 14:24:58 +08:00
productFlavors.xhj_dev.signingConfig signingConfigs.xhj
productFlavors.xhj_pre.signingConfig signingConfigs.xhj
2024-06-17 10:52:06 +08:00
}
2023-07-10 17:50:31 +08:00
release {
// 高德地图导致release编译模式下应用闪退根据[高德地图在Debug模式下运行正常但是打Release包时则闪退解决办法](https://blog.csdn.net/weixin_39370093/article/details/109631210)
// 为release模式设置混淆可以解决地图闪退问题
// 真实的解决办法
2024-09-07 20:41:09 +08:00
minifyEnabled true
shrinkResources true
productFlavors.local.signingConfig signingConfigs.debug
productFlavors.dev.signingConfig signingConfigs.debug
productFlavors.pre.signingConfig signingConfigs.debug
productFlavors.sky.signingConfig signingConfigs.sky
2024-12-31 14:24:58 +08:00
productFlavors.sky_dev.signingConfig signingConfigs.sky
productFlavors.sky_pre.signingConfig signingConfigs.sky
productFlavors.xhj.signingConfig signingConfigs.xhj
2024-12-31 14:24:58 +08:00
productFlavors.xhj_dev.signingConfig signingConfigs.xhj
productFlavors.xhj_pre.signingConfig signingConfigs.xhj
2023-09-28 18:05:23 +08:00
}
2023-07-10 17:50:31 +08:00
}
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "app-starlock-${variant.buildType.name}-${variant.flavorName}-${defaultConfig.versionName}.apk"
}
}
2023-07-10 17:50:31 +08:00
}
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.amap.api:3dmap-location-search:latest.integration')
2024-03-20 10:42:12 +08:00
implementation 'cn.jiguang.sdk:jpush:5.2.3'
// 接入华为厂商
2024-05-28 10:42:34 +08:00
implementation 'com.huawei.agconnect:agconnect-core:1.8.1.300'
implementation 'com.huawei.hms:push:6.12.0.300'
implementation 'cn.jiguang.sdk.plugin:huawei:5.2.3'
// 接入小米厂商
implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3'
//接入OPPO厂商
implementation 'cn.jiguang.sdk.plugin:oppo:5.2.3'
//引入 libs 中的 aar如果项目中有此依赖不需要重复引用
2024-09-07 20:41:09 +08:00
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
//OPPO 3.1.0 aar 及其以上版本需要添加以下依赖
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'commons-codec:commons-codec:1.6'
implementation 'androidx.annotation:annotation:1.1.0'
2024-09-07 20:41:09 +08:00
// 接入荣耀厂商
implementation 'cn.jiguang.sdk.plugin:honor:5.2.3'
//需要单独引入荣耀厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
// implementation(name: 'HiPushSDK-7.0.61.303', ext: 'aar')
//接入 VIVO 厂商
implementation 'cn.jiguang.sdk.plugin:vivo:5.2.3'
// Umeng统计
//<cn>
2025-01-08 17:19:07 +08:00
implementation 'com.umeng.umsdk:common:9.7.9'
implementation 'com.umeng.umsdk:asms:1.8.5'
//</cn>
2025-02-20 17:01:46 +08:00
//<com>
2025-06-05 14:31:39 +08:00
// implementation 'cn.jiguang.sdk.plugin:fcm:5.2.3'
// implementation 'com.google.firebase:firebase-messaging:23.0.5'
2025-02-20 17:01:46 +08:00
//</com>
2025-06-05 14:31:39 +08:00
//FCM云消息与极光FCM插件
implementation 'com.google.firebase:firebase-messaging:23.2.1'
implementation 'cn.jiguang.sdk.plugin:fcm:5.2.2'
2023-07-10 17:50:31 +08:00
}