169 lines
7.5 KiB
Groovy
169 lines
7.5 KiB
Groovy
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"
|
||
}
|
||
//打包太和e护需要屏蔽这个插件
|
||
apply plugin: 'com.huawei.agconnect'
|
||
|
||
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.5"
|
||
}
|
||
|
||
android {
|
||
// namespace = "com.taihe.vbvs_app"
|
||
namespace = "com.taihe.mianhuatang"
|
||
// compileSdk = flutter.compileSdkVersion
|
||
compileSdk = localProperties.getProperty('flutter.compileSdkVersion').toInteger()
|
||
|
||
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.toString()
|
||
}
|
||
|
||
defaultConfig {
|
||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||
// applicationId "com.taihe.vbvs_app"
|
||
applicationId "com.taihe.mianhuatang"
|
||
// You can update the following values to match your application needs.
|
||
// 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
|
||
|
||
ndk {
|
||
//选择要添加的对应 cpu 类型的 .so 库。
|
||
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a'
|
||
}
|
||
|
||
manifestPlaceholders = [
|
||
JPUSH_PKGNAME : "com.taihe.mianhuatang",
|
||
JPUSH_APPKEY : "ef31d487137311ed3d63ea7d", // NOTE: JPush 上注册的包名对应的 Appkey.
|
||
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
|
||
XIAOMI_APPKEY : "MI-5152036593702", // 小米平台注册的appkey,注意不要将前缀去掉 MI-appkey
|
||
XIAOMI_APPID : "MI-2882303761520365702", // 小米平台注册的appid,注意不要将前缀去掉 MI-appid
|
||
VIVO_APPKEY : "a296a05be8eca520e4d44b0c6495353f",
|
||
VIVO_APPID : "105824696",
|
||
HONOR_APPID : "900905976",
|
||
OPPO_APPKEY : "OP-5233131f213a440dbdb74eb1552b9dee", // OPPO平台注册的appkey
|
||
OPPO_APPID : "OP-32509325", // OPPO平台注册的appid
|
||
OPPO_APPSECRET: "OP-ba89d834fa4248318074dd19d2f1ac92"//OPPO平台注册的appsecret
|
||
]
|
||
|
||
resValue "string", "applicationName", "com.taihe.mianhuatang.MyApplication"
|
||
}
|
||
|
||
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.release
|
||
android.applicationVariants.all { variant ->
|
||
variant.outputs.all {
|
||
outputFileName = "THYH_v${variant.versionName}-${releaseTime()}.apk"
|
||
}
|
||
}
|
||
}
|
||
debug {
|
||
debuggable true
|
||
// signingConfig signingConfigs.release
|
||
}
|
||
}
|
||
}
|
||
|
||
static def releaseTime() {
|
||
return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
|
||
}
|
||
|
||
flutter {
|
||
source = "../.."
|
||
}
|
||
|
||
dependencies {
|
||
// implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
|
||
// 此处以JPush 5.6.0 版本为例,注意:从 5.0.0 版本开始可以自动拉取 JCore 包,无需另外配置
|
||
implementation 'cn.jiguang.sdk:jpush:5.6.0'
|
||
|
||
//若不集成厂商通道,可直接跳过以下依赖
|
||
// 极光厂商插件版本与接入 JPush 版本保持一致,下同
|
||
// 接入华为厂商
|
||
implementation 'com.huawei.hms:push:6.13.0.300'
|
||
implementation 'cn.jiguang.sdk.plugin:huawei:5.6.0'
|
||
|
||
// 接入 FCM 厂商
|
||
implementation 'com.google.firebase:firebase-messaging:24.1.0'
|
||
implementation 'cn.jiguang.sdk.plugin:fcm:5.6.0'
|
||
|
||
// 接入 VIVO 厂商
|
||
implementation 'cn.jiguang.sdk.plugin:vivo:5.6.0'
|
||
|
||
|
||
// 接入小米厂商
|
||
implementation 'cn.jiguang.sdk.plugin:xiaomi:5.6.0'
|
||
|
||
// // 接入 OPPO 厂商
|
||
implementation 'cn.jiguang.sdk.plugin:oppo:5.6.0'
|
||
// // JPush Android SDK v4.6.0 开始,需要单独引入 oppo 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/oppo/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
|
||
implementation(name: 'com.heytap.msp_3.5.3', ext: 'aar')
|
||
// //以下为 OPPO 3.1.0 aar需要依赖
|
||
implementation 'com.google.code.gson:gson:2.10.1'
|
||
implementation 'commons-codec:commons-codec:1.6'
|
||
implementation 'androidx.annotation:annotation:1.1.0'
|
||
|
||
// 接入荣耀厂商
|
||
implementation 'cn.jiguang.sdk.plugin:honor:5.6.0'
|
||
// //需要单独引入荣耀厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
|
||
implementation(name: 'HiPushSDK-8.0.12.307', ext: 'aar')
|
||
} |