3

I'm trying to upgrade an old project. Actually, I had to upgrade targetAPILevel to 33 from 30 which eventually requires JDK upgrade from 1.8 to 11.I could be wrong but JDK 11 requires Gradle version upgrade from 4.2 to 7. So I did upgrade Gradle to 7. Now gradle build was working fine on 4.2 but on version 7 it doesn't build gradle.build and throws following error.


Could not compile build file '/Users/builder/Documents/payment/Clients/iOS/build.gradle'.
> startup failed:
  build file '/Users/builder/Documents/payment/Clients/iOS/build.gradle': 117: Unexpected input: '{' @ line 117, column 28.
     gradle.taskGraph.whenReady { taskGraph ->  

It complains about "{". I have basic knowledge of gradle tasks and I'm learning as doing all of this.

following is the Gradle code where this line came from :

gradle.taskGraph.whenReady { taskGraph ->

    if (taskGraph.hasTask(package) ) {
        if (project.hasProperty('buildtype')) {
            buildType = buildtype
            println "### Project has buildType = $buildType"
        }

Can someone please guide me how to handle this?

Aris O
  • 99
  • 5
Faisal
  • 705
  • 3
  • 16
  • See if answers from [this](https://stackoverflow.com/q/25844546/14577209) will help you. And the updated answer of [this](https://stackoverflow.com/a/49112492/14577209) as well. – Maleesha97 Mar 14 '23 at 11:53
  • The code snippet you included in your question has two open curly braces '{' that do not have corresponding closing braces '}'. Does the full code have these closing braces? – j_b Mar 16 '23 at 19:57
  • The line of code you provided looks like a hook for executing code when the Gradle task graph is ready. This feature is available in Gradle 4.3 and later versions. So, if you are using Gradle 7, this line should work without any issues. – M.Mevlevi Mar 16 '23 at 23:27

0 Answers0