赞
踩
- KEY_PATH=xxx.jks
- KEY_PASS=xxx
- ALIAS_NAME=xxx
- ALIAS_PASS=xxx
- android {
-
- signingConfigs {
- config {
- storeFile file(KEY_PATH)
- storePassword KEY_PASS
- keyAlias ALIAS_NAME
- keyPassword ALIAS_PASS
- }
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.config
- buildConfigField 'String', 'SERVER2', getSERVER2('release')
- }
-
- debug {
- buildConfigField 'String', 'SERVER2', getSERVER2('debug')
- }
- }
- }
-
- // 获取配置文件内容的地址
- def getSERVER2(String str) {
- def SERVER2 // 定义变量
- def Properties properties = new Properties()
- def proFile = file('src/main/filters/' + str + '/config.properties') // 配置文件地址的路径
- if (proFile.canRead()) { // 读取
- properties.load(new FileInputStream(proFile)) // 加载
- if (properties != null) {
- SERVER2 = properties['SERVER2'] // 赋值
- }
- }
- SERVER2
- }
debug-config.properties SERVER2 = "https://debug.com"
release-config.properties SERVER2 = "https://release.com"
=============================================================
链接:https://blog.csdn.net/myth13141314/article/details/73616580
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。