原因:
build.gradle中修改apk名称输出目录等操作调用将废弃的api
如output.outputFile output.packageApplication
applicationVariants.all { variant ->
variant.outputs.all { output ->
def outputFile = output.outputFile
...
if (outputFile != null && outputFile.name.endsWith('.apk')) {
...
}
}
}
可以直接删掉或者替换掉
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith(’.apk’)) {
}
//将app移动到项目根目录
def relativeRootDir = output.packageApplication.outputDirectory.toPath()
.relativize(rootDir.toPath()).toFile()
outputFileName = new File("$relativeRootDir/apk", fileName)
简单粗暴的方法是将
outputFileName = new File("$relativeRootDir/apk", fileName)
改为
outputFileName = new File("../../../../../../apk", fileName)