我想更改 APK 输出文件夹
,这是我以前做的:
applicationVariants.all { variant ->
variant.outputs.all {
def filePath = "${rootProject.rootDir.absolutePath}/apks/${variant.name}"
println("My Path: " + filePath)
outputFileName = filePath
}
}
但是,它在 Gradle 4.1
(Android Studio 3.0 预览版)中不起作用。它没有将文件夹生成为上面的路径,而是在旧的 debug
文件夹中生成了上面的路径,如下图所示:
有人对此有解决方案吗?谢谢。
最佳答案
这是升级到 gradle 4.x 后保持输出路径相同的解决方法。
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "../" + outputFileName
}
}
现在apk在platforms/android/build/outputs/apk/android-release.apk生成
关于android - 在 Gradle 4.1 中更改 apk 输出文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46985530/