直接上代码:


import java.text.SimpleDateFormatapply plugin: 'com.android.application'android {    compileSdkVersion 23    buildToolsVersion "23.0.2"    defaultConfig {        applicationId "com.dsy.myapplication"        minSdkVersion 15        targetSdkVersion 23        versionCode 1        versionName "1.0"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }    applicationVariants.all { variant ->        variant.outputs.each { output ->            def file = output.outputFile            output.outputFile = new File(file.parent,                    "myapp-" + defaultConfig.versionName + "-" + buildTime() + ".apk")            //生成的文件名:myapp+版本名+生成日期+.apk        }    }}def buildTime() {    def df = new SimpleDateFormat("yyyyMMdd")    df.setTimeZone(TimeZone.getDefault())    return df.format(new Date())}dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    compile 'com.android.support:support-v4:23.1.1'}


更多相关文章

  1. android 自动更新apk版本
  2. 修改android 系统设置 android 版本
  3. android 版本更新
  4. Android版本号对应API、版本名称、NDK版本等
  5. Android从1.0到11版本特性
  6. 下载不同版本android studio
  7. Mac版Android studio中使用lambda表达式设置jdk版本问题
  8. Android 获取当前日期 时间
  9. android 中 系统日期时间的获取

随机推荐

  1. Android(安卓)用Animation-list实现逐帧
  2. Android(安卓)在代码中动态设置字体颜色
  3. Android中HTTP相关的API
  4. ubuntu14.04 android光盘集成信息
  5. Android Handler机制分析
  6. Android消息队列(三)--多线程与消息处理
  7. android content providers相关
  8. 在android中用TimePicker和DatePicker或
  9. Android/ios/h5 三步调起QQ群聊,一键加群
  10. android构建自定义View和自定义组件