variantOutput.getPackageApplication()gradle 4.10.1 打包问题

WARNING: API 'variantOutput.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getPackageApplication(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app
   //gradle 4.10.1 之前自定义打包
//    applicationVariants.all { variant ->
//        variant.outputs.all { output ->
//            def outputFile = output.outputFile
//
//            if (outputFile != null && outputFile.name.endsWith('.apk')) {
//
//                def fileName = "app_${variant.versionCode}_${variant.versionName}_${releaseTime()}.apk"
//
//                outputFileName = fileName
//            }
//        }
//    }
    //更新至gradle 4.10.1后自定义打包变化
    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = "app_${variant.versionCode}_${variant.versionName}_${releaseTime()}.apk"
        }
    }
// 打包时间
static def releaseTime() {
    return new Date().format("yyyy-MM-dd-HH-mm-ss", TimeZone.getTimeZone("GMT+8"))
}

你可能感兴趣的:(项目打包)