I've done a lot of Android dev never needing to understand gradle well.
Ideally I'd be running a python script after setting up a virtualenv, but for this question I'm happy with a MWE.
task rem(type: Exec) {
doLast {
exec {
workingDir '.'
commandLine 'dir'
}
}
}
Results in:
> Task :app:rem FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:rem'.
> execCommand == null!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
1 actionable task: 1 executed
Let's say I go back to how I was declaring my tasks before shelling out:
task rem {
without (type: Exec)
I get:
> A problem occurred starting process 'command 'dir''
where before I had
> execCommand == null!
I have only got the following commandLine
to work:
task rem(type: Exec) {
commandLine 'python', '--version'
}
replacing body with commandLine 'dir'
fails with
...
> A problem occurred starting process 'command 'dir''
...