123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- import org.json.JSONObject
- apply plugin: 'com.android.application'
- apply plugin: "androidx.navigation.safeargs"
- // 获取最新版本名称和版本号
- def newVersion = new JSONObject(file('../version_info.json').text).optJSONArray("info").getJSONObject(0)
- def vName = newVersion.optString("versionName")
- def vCode = newVersion.optLong("versionCode")
- println vName
- println vCode
- android {
- compileSdkVersion 28
- defaultConfig {
- applicationId "com.unis.sxzcl"
- minSdkVersion 16
- targetSdkVersion 28
- versionCode vCode.toInteger()
- versionName vName
- ndk {
- //设置支持的SO库架构
- abiFilters 'armeabi-v7a' //,'x86', 'x86_64', 'arm64-v8a'
- }
- multiDexEnabled true
- manifestPlaceholders = [
- JPUSH_PKGNAME : applicationId,
- JPUSH_APPKEY : "364961d3e7f43b10b3555e51",//值来自开发者平台取得的AppKey
- JPUSH_CHANNEL : "default_developer",
- //xiaomi_config_start
- XIAOMI_APPID : "MI-小米的APPID",
- XIAOMI_APPKEY : "MI-小米的APPKEY",
- //xiaomi_config_end
- //oppo_config_start
- OPPO_APPKEY : "OP-oppo的APPKEY",
- OPPO_APPID : "OP-oppo的APPID",
- OPPO_APPSECRET: "OP-oppo的APPSECRET",
- //oppo_config_end
- //vivo_config_start
- VIVO_APPKEY : "vivo的APPKEY",
- VIVO_APPID : "vivo的APPID",
- //vivo_config_end
- ]
- flavorDimensions "channel"
- }
- // view绑定
- // viewBinding {
- // enabled = true
- // }
- buildFeatures {
- viewBinding = true
- }
- // 签名配置
- signingConfigs {
- release {
- v1SigningEnabled true
- v2SigningEnabled true
- storeFile file(KEY_PATH)
- storePassword KEY_PWD
- keyAlias = ALIAS_NAME
- keyPassword ALIAS_PWD
- }
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.release
- zipAlignEnabled = true
- }
- debug {
- signingConfig signingConfigs.release
- }
- }
- compileOptions {
- sourceCompatibility 1.8
- targetCompatibility 1.8
- }
- sourceSets {
- main {
- jniLibs.srcDirs = ['libs']
- }
- }
- repositories {
- flatDir {
- dirs 'libs'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- abortOnError false
- }
- //配置自定义打包名称和位置
- android.applicationVariants.all { variant ->
- // 将apk文件输出到 /apk/release 或 /apk/debug
- if (variant.buildType.name.equals('release')) {
- variant.getPackageApplicationProvider().get().outputDirectory = new File("../apk/" + variant.buildType.name)
- }
- variant.outputs.all { output ->
- def date = new Date().format("yyyyMMddHHmm")
- def versionName = defaultConfig.versionName
- def versionCode = defaultConfig.versionCode
- def buildType = variant.buildType.name
- // 输出的apk名称
- // sxzcl_release_x.x_x.apk
- outputFileName = "sxzcl_${buildType}_${versionName}_${versionCode}.apk"
- }
- }
- }
- dependencies {
- implementation fileTree(dir: "libs", include: ["*.jar"])
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
- implementation 'com.android.support:design:28.0.3'
- implementation 'com.android.support:support-v4:28.0.0'
- implementation 'com.google.android:flexbox:2.0.1'
- implementation 'com.android.support:multidex:1.0.3'
- api project(path: ':icon')
- api project(path: ':model')
- //状态栏框架
- implementation 'com.jaeger.statusbarutil:library:1.5.1'
- //图片压缩
- implementation 'com.github.nanchen2251:CompressHelper:1.0.5'
- //轮播图
- implementation 'com.youth.banner:banner:2.1.0'
- implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
- //图表库
- implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
- implementation 'androidx.navigation:navigation-fragment:2.3.2'
- implementation 'androidx.navigation:navigation-ui:2.3.2'
- // 极光推送
- implementation 'cn.jiguang.sdk:jpush:3.8.6' // 此处以JPush 3.8.6 版本为例。
- implementation 'cn.jiguang.sdk:jcore:2.6.0' // 此处以JCore 2.6.0 版本为例。
- }
|