After updating studio 3.4
and Gradle version to 5.1.1
I got the error on my task as Could not find method leftShift()
My task:
task incrementBetaVersion << {
println("Incrementing Beta Version Number...")
incrementVersionNumber('BetaVersionNumber')
println("Incrementing Beta Version Number...")
incrementVersionName('BetaVersionName')
}
I got the error for the left shift operator <<
in the line.
How to resolve this error?
It happening because of the Left Shift operator has been replaced by doLast { }.
Now you will have to change the code:
to
I had this error in a Kotlin project that is using
MockMaker
to mock non final classes.The solution is to change the old syntax to this new one:
Note that a few things have changed, like including the
doLast
block, and removing the<<
from the task signature. It works for me now. Hope it does for you too :-)For solution of
Could not find method leftShift() for arguments on task of type org.gradle.api.DefaultTask
Just Remove "<<" from Task and add method in
doLast{}
Reference https://discuss.gradle.org/t/could-not-find-method-leftshift-for-arguments-on-task-of-type-org-gradle-api-defaulttask/30614/2
to
To solve this error, change
<<
withdoLast
like this.Left shitf operator represent's
doLast { }
.From Docs:
<<
for task definitions no longer works. In other words, you can not use the syntaxtask myTask << { … }
.Use the
Task.doLast()
method instead, like this:More info here: https://discuss.gradle.org/t/could-not-find-method-leftshift-for-arguments-on-task-of-type-org-gradle-api-defaulttask/30614
https://docs.gradle.org/current/userguide/upgrading_version_4.html#changes_5.0