I need to do some build operations only during release build to speed up the routine debug build. How to test, if I'm doing a release build in the build.gradle
script?
splits {
abi {
enable /* CONDITION HERE -> */ true
reset()
include 'x86', 'armeabi-v7a', 'mips'
universalApk true
}
}
I found an example here , but I don't want to set build property, I prefer it to be automatic.
Please try:
splits {
abi {
if (project.gradle.startParameter.taskNames.any { it.toLowerCase().contains('release') }) {
enable true
reset()
include 'x86', 'armeabi-v7a', 'mips'
universalApk true
} else {
enable true
reset()
include 'armeabi-v7a'
universalApk false
}
}
}
However, mind the fact that this configuration doesn't take task dependencies into account. What I mean is a task may depend on some release task and even if it isn't passed via command line it might be executed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.