今天运行项目,运行的debug出来的包竟然是命名过的,但是我的buildTypes里面的debug 并没有执行重命名操作。很奇怪,我的猜测是: 执行buildTypes的时候,虽然是assermdebug,但是确实走了release里面的东西

求大神指点:

build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.aaa.ccc"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled true buildConfigField("String", "ChannelId", '"116118"') //渠道号
}
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true" //log 日志
buildConfigField "String", "URL_CONFIG", "\"huidu\"" // url 配置:official,huidu,fangzhen
minifyEnabled false
zipAlignEnabled false
debuggable true
shrinkResources false
}
release {
minifyEnabled true
proguardFiles 'proguard-project.txt'
debuggable false
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "String", "URL_CONFIG", "\"official\"" def versionN = getTodayReleaseVersion()
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "baiduapp_v${getVersionName()}_${releaseDay()}_build${versionN}.apk"
output.outputFile = new File(outputFile.parent,fileName)
}
}
}
}
}
productFlavors {
} lintOptions{
abortOnError false
}
sourceSets{
main {
jniLibs.srcDirs = ['jniLibs']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
} dependencies {
compile project(':plug')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:23.1.1'
}
def releaseDay(){
return new Date().format("yyyyMMdd",TimeZone.getTimeZone("UTC"))
} def getTodayReleaseVersion(){
def runTasks = gradle.startParameter.taskNames;
def versionPropsFile = file('buildver.properties')
def today = releaseDay()
if(versionPropsFile.canRead()){
def versionId = 1
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
def releaseDay = versionProps.get("RELEASE_DAY")
if(releaseDay.equals(today)) {
versionId = versionProps.get('VERSION_NAME').toInteger()
println("-------------"+runTasks);
def isRelase = false
runTasks.each { task ->
if(task.contains("assembleRelease")){
isRelase = true
}
}
if(isRelase){
versionId++
}
}else{
versionProps["RELEASE_DAY"] = today;
} versionProps['VERSION_NAME'] = versionId.toString()
versionProps.store(versionPropsFile.newWriter(),null)
return versionId.toString();
}else{
versionPropsFile.createNewFile();
def Properties versionProps = new Properties();
versionProps["RELEASE_DAY"] = releaseDay;
versionProps['VERSION_NAME'] = versionId.toString()
versionProps.store(new FileOutputStream(versionPropsFile),null)
}
return "1";
} def getVersionName(){
def fileManifest = file("src/main/AndroidManifest.xml")
def androidManifest = new XmlSlurper().parse(fileManifest)
return androidManifest.@'android:versionName'
}

最新文章

  1. iOS开发路线简述
  2. java的前台与后台
  3. 每日英語2013.09.09(Email常用單字)
  4. 从个人的角度谈谈本次GNTC大会的收获
  5. C#虚方法认识
  6. 20160129.CCPP体系详解(0008天)
  7. 节点与坐标系——Cocos2d-x学习历程(十)
  8. HTML学习(五)链接
  9. vim - manual -个人笔记
  10. GirdView分页
  11. make menuconfig 笔记
  12. div盒子水平居垂直中的几种方法
  13. [tomcat] tomcat简析(一)
  14. shell脚本编写某一文件夹内拷贝某一段文件(有则跳过没有则拷贝)
  15. java29
  16. ORM对单表的增删改查
  17. node封装mysql操作
  18. 关于sdl_ttf使用字体库加载失败的问题
  19. sudo: Cannot execute /usr/local/bin/zsh: No such file or directory 问题
  20. D3——Axes

热门文章

  1. HashWithIndifferentAccess
  2. JAVA StringBuffer的用法
  3. DataGrid 样式
  4. javascript中的循环引用对象处理
  5. C++学习之继承中的成员访问控制
  6. selenium使用谷歌浏览器自带手机模拟器运行H5网页
  7. 【BZOJ3622】已经没有什么好害怕的了(动态规划+广义容斥)
  8. jQuery 遍历函数包括了用于筛选、查找和串联元素的方法。
  9. Docker 入门教程与实践
  10. 第39章 ETH—Lwip以太网通信—零死角玩转STM32-F429系列