Could not find method commandLine()

Viewed 10018

I'm attempting to add a pre-pre-build shell script to my gradle/Android-Studio build. I've added the following to app/build.gradle:

task prePreBuild << {
  commandLine 'ls'
}
preBuild.dependsOn prePreBuild

When I invoke my build with ./gradlew assembleDebug I get the following error:

Could not find method commandLine() for arguments [ls] on project ':app'

If I replace the commandLine line with something like println 'Hello' then it works fine, and I can see the output from my new task.

I searched for other mentions of "Could not find method commandLine" and found nothing. What is the correct way to invoke a shell script from this gradle task?

1 Answers
Related