Could not find method leftShift() for arguments after updating studio 3.4

Solution 1:

To solve this error, change << with doLast like this.

task incrementBetaVersion  {
    doLast {
        println("Incrementing Beta Version Number...")
        incrementVersionNumber('BetaVersionNumber')
        println("Incrementing Beta Version Number...")
        incrementVersionName('BetaVersionName')
    }
}

Left shift operator represent's doLast { }.

<< was deprecated in Gradle 4.x and removed in Gradle 5.0

From Docs:

<< for task definitions no longer works. In other words, you can not use the syntax

task myTask << { …​ }.

Use the Task.doLast() method instead, like this:

task myTask {
    doLast {
        ...
        ...
    }
}

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

Solution 2:

Just Remove "<<" from Task and add your code in doLast{}

For solution of Could not find method leftShift() for arguments on task of type org.gradle.api.DefaultTask

task incrementBetaVersion << {
   // your code
}

to

task incrementBetaVersion {
   doLast {
      // your code
    }
}

Reference https://discuss.gradle.org/t/could-not-find-method-leftshift-for-arguments-on-task-of-type-org-gradle-api-defaulttask/30614/2

<< (LeftShift()) operator is deprecated in 4.x Gradle and Removed in 5.x Gradle Version.

Solution 3:

It happening because of the Left Shift operator has been replaced by doLast { }.

<< has deprecated in 4.x and removed in 5.0 version

Now you will have to change the code:

task incrementBetaVersion << {
    println("Incrementing Beta Version Number...")
    incrementVersionNumber('BetaVersionNumber')
    println("Incrementing Beta Version Number...")
    incrementVersionName('BetaVersionName')
}

to

task incrementBetaVersion  {
    doLast {
        println("Incrementing Beta Version Number...")
        incrementVersionNumber('BetaVersionNumber')
        println("Incrementing Beta Version Number...")
        incrementVersionName('BetaVersionName')
    }
}