安卓自定义打包生成的文件名字

在项目主module下面添加下面的代码,红色部分代码

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

def bugtagsConfig = rootProject.ext.bugtagsConfig;

android {

    // for bugtags
    useLibrary 'org.apache.http.legacy'

    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION
    dataBinding {
        enabled = true
    }
    defaultConfig {
        applicationId "com.mem.MacaoLife"
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION
        versionCode APP_VERSION_CODE
        versionName APP_VERSION_NAME
        //是否禁用外卖模块
        buildConfigField "boolean", "DIABLE_TAKEAWAY", "true"
        //bugtags app key信息
        buildConfigField "String", "BUGTAGS_APP_KEY", "\"${bugtagsConfig.BUGTAGS_APP_KEY}\""
        ndk {
            // 设置支持的 SO 库构架
            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips', 'mips64'
        }
    }
    signingConfigs {
        debug {
            storeFile file("../readme/keystore/debug.keystore")
        }
        release {
            storeFile file('../readme/keystore/releasekey.jks')
            storePassword "123456"
            keyAlias "demo"
            keyPassword "123456"
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    def outputFile = output.outputFile
                    if (outputFile != null && outputFile.name.endsWith('.apk')) {
                        // 输出apk名称为release_v1.0_2015-01-15.apk
                        def fileName = "release_v${defaultConfig.versionName}_${releaseTime()}.apk"
                        output.outputFile = new File(outputFile.parent, fileName)
                    }
                }
            }
        }
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

}

def releaseTime() {
    return new Date().format("yyyy-MM-dd-hh-mm", TimeZone.getDefault())
}

//应用 Bugtags 插件
apply plugin: 'com.bugtags.library.plugin'
//Bugtags 插件配置
bugtags {
    //自动上传符号表功能配置,如果需要根据 build varint 配置,请参考帮助中心->符号表->Android 符号表->配置自动上传符号表
    appKey bugtagsConfig.BUGTAGS_APP_KEY  //这里是你的 appKey
    appSecret bugtagsConfig.BUGTAGS_APP_SECRET    //这里是你的 appSecret,管理员在设置页可以查看
    mappingUploadEnabled true
}

dependencies {
    apt 'org.parceler:parceler:1.1.6'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':lib')
    compile project(':thirdsdk:baidumapsdk')
    compile project(':thirdsdk:sharesdk')
    compile project(':thirdsdk:wechatpay')
    compile 'com.aurelhubert:ahbottomnavigation:2.0.4'
    compile 'org.parceler:parceler-api:1.1.6'
    compile 'com.facebook.fresco:fresco:1.1.0'
    compile 'net.cachapa.expandablelayout:expandablelayout:2.8'
    compile 'com.bugtags.library:bugtags-lib:latest.integration'
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值