def cfg = rootProject.ext.configuration // 配置def libs = rootProject.ext.libraries // 库android {    compileSdkVersion cfg.compileVersion    buildToolsVersion cfg.buildToolsVersion    defaultConfig {        applicationId cfg.pagename        minSdkVersion cfg.minSdk        targetSdkVersion cfg.targetSdk        versionCode cfg.version_code        versionName cfg.version_name        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }    //在apk文件后边生成版本号信息    android.applicationVariants.all {        variant ->            variant.outputs.all {            outputFileName = "app_"+ buildType.name + "_v${defaultConfig.versionName}-${releaseTime()}.apk"        }    }}def releaseTime() {        return new Date().format("yyyy_MM_dd", TimeZone.getTimeZone("UTC"))

}

releaseTime 要写在android {} 外边 
apk 包名的定义 要写在 android 里面

 

//在apk文件后边生成版本号信息    android.applicationVariants.all {        variant ->            variant.outputs.all {            outputFileName = "app_"+ buildType.name + "_v${defaultConfig.versionName}-${releaseTime()}.apk"        }    }
            


更多相关文章

  1. android 自定义View 在布局文件中写法
  2. Android上传下载文件(图片)
  3. android 录像/打开video文件
  4. (原)Eclipse的java中文件读写
  5. Android File文件操作
  6. Android Button Maker(在线生成android shape xml文件的工具),真方
  7. Android 获取手机卡相关信息

随机推荐

  1. Android(安卓)Studio出现Failed to open
  2. Android重写SimpleCursorAdapter例子
  3. 提升基于英特尔® 架构的 Android* 模拟
  4. android组件
  5. android 播放Raw文件夹下的音乐文件
  6. android中Notification的使用
  7. Android(安卓)屏幕截图 代码
  8. Android(安卓)2.3 编译
  9. android js 互动事件
  10. ffmpeg-2.3.3 configure for android