要在build.gradle文件的android中增加如下配置
android.applicationVariants.all { variant ->
variant.outputs.all {
variant.getPackageApplication().outputDirectory = new File(project.rootDir.absolutePath + "/build/outputs/apk/release")
outputFileName = "${project.name}_${defaultConfig.versionName}_${variant.buildType.name}.apk"
}
}