Weird error reporting

I have in project gradle file shared method defined like

project.ext.evalVersionCode = {

def p = Runtime.getRuntime().exec(“git rev-list --all --count”)

def result = p.waitFor()

if (result != 0) {

return 0

}

return p.getInputStream().readLines().get(0).toInteger() }

If I do some mistake, like change p.watFor() to p.waitForr(), I expect that gradle will display error like “Could not find method waitForr()…” But gradle will display this

  • Where: Build file ‘…\app\build.gradle’ line: 11 * What went wrong: A problem occurred evaluating project ‘:app’. > Could not find method evalVersionCode() for arguments [] on ProductFlavorDsl_Decorated{…}.

It is almost impossible to found real reason, on the line 11 is only used call “evalVersionCode()”

Is it bug?

Try running with ‘–stacktrace’ to get the full stack trace of the exception.

No, it doesn’t help