2

When I create a new multiplatform project using the KMM Application template in Android Studio, I get the following error:

The Gradle wrapper is required to run the build from Xcode.

Please run the same command with `-Pkotlin.native.cocoapods.generate.wrapper=true` or run the `:wrapper` task to generate the wrapper manually.

See details about the wrapper at https://docs.gradle.org/current/userguide/gradle_wrapper.html

The project can not be run, it has no configuration available:

enter image description here

I am using Android Studio latest version: Android Studio - Arctic Fox | 2020.3.1 Patch 2 on macOS.

The version of gradle installed is 7.0

enter image description here

Android Studio also displays the following warning:

enter image description here

Clicking on Load Gradle Project brings to the same error:

enter image description here

The gradle-wrapper.properties file uses gradle-7.0.2-bin.zip. (there is no distribution version gradle-7.0-bin.zip available)

When I try to create a gradlew file I get the following error:

enter image description here

I do not know to which command I can pass the option -Pkotlin.native.cocoapods.generate.wrapper=true.

Changing the version of gradle in gradle-wrapper.properties as suggested brings to the following error after synchronizing the project:

enter image description here

I have never had any problem when using the KMM Application template of Android Studio.

Did someone have any idea what is happening and what I can do ?

eqtèöck
  • 971
  • 1
  • 13
  • 27
  • I've had the same problem today. Fixed with `brew upgrade gradle`. Then, with Gradle 7.2, thee project worked as expected. – Artyom Degtyarev Sep 14 '21 at 14:52
  • Thanks for your comment @Artyom Degtyarev, but it did not work for me. I have now gradle 7.2 installed, and AS always complains about "The Gradle wrapper is required to run the build from Xcode." – eqtèöck Sep 20 '21 at 13:00
  • 1
    Hmm. HAve you tried to remove all gradle-related stuff from your project, and creating new wrapper with executing `gradle wrapper` from CLI. – Artyom Degtyarev Sep 20 '21 at 15:22
  • Thank you @Artyom Degtyarev! deleting the `.gradle` folder and creating a new wrapper `$ gradle wrapper` solved the problem. – eqtèöck Sep 25 '21 at 10:33

1 Answers1

2

For the record here is the solution, all the credits go to @Artyom Degtyarev.

  1. remove the .gradle folder of the project
  2. create a new wrapper with the command gradle wrapper in your terminal
  3. sync your project with the gradle files

Once the synchronization done, the error message is not displayed anymore and the project is executable.

these operation have been done with Gradle 7.2

eqtèöck
  • 971
  • 1
  • 13
  • 27