Help Center/ CodeArts Build/ FAQs/ Using Gradle for Build/ Failing to Find Gradle of the Specified Version
Updated on 2024-10-10 GMT+08:00

Failing to Find Gradle of the Specified Version

Symptoms

Failed to find the required Gradle version during action editing.

Cause Analysis

  • If the Gradle version on which a project to be compiled depends is not in the list, you can use gradlew(gradle wrapper) to encapsulate Gradle commands.
  • The Gradle commands are encapsulated in Gradlew. The Gradle of the specified version will be installed before the build commands are executed.
  • Gradle recommends that Wrapper files be created in all Gradle projects to facilitate users who have not installed Gradle.

Using Gradle Wrapper

  1. In the local environment, go to the root directory of the code and run the Gradle Wrapper command. After the command is executed, the following files are added to the code repository:

    • gradlew (Unix Shell script)
    • gradlew.bat (Windows batch processing file)
    • gradle/wrapper/gradle-wrapper.jar (Wrapper JAR file)
    • gradle/wrapper/gradle-wrapper.properties (Wrapper file)

  2. Commit the code to the code repository.
  3. Modify the statement in the command line of the build task and replace gradle with ./gradlew. For example, replace gradle build with ./gradlew build.