KMM template project of Android Studio does not create a runnable project

Viewed 415

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 ?

1 Answers

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

Related