How to change the version of the 'default gradle wrapper' in IntelliJ IDEA?

前端 未结 8 1157
忘掉有多难
忘掉有多难 2020-12-23 15:42

I want to use Gradle 1.10 instead of 1.9. I cannot seem to find where to change this.

If I put this:

task wrapper(t         


        
相关标签:
8条回答
  • 2020-12-23 16:08

    First, let gradle set the correct distribution Url

    cd projectDirectory
    ./gradlew wrapper --gradle-version 2.3.0
    

    Then - might not be needed but that's what I did - edit the project's build.gradle to match the version

        dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    

    Finally, delete the folders .gradle and gradle and the files gradlew and gradlew.bat. (Original Answer)

    Now, rebuild the project.

    As the other answers did not suffice for me and the comment pointing out these additional steps is easy to overlook, here as a separate answer

    0 讨论(0)
  • 2020-12-23 16:11

    The easiest way is to execute the following command from the command line (see Upgrading the Gradle Wrapper in documentation):

    ./gradlew wrapper --gradle-version 5.5
    

    Moreover, you can use --distribution-type parameter with either bin or all value to choose a distribution type. Use all distribution type to avoid a hint from IntelliJ IDEA or Android Studio that will offer you to download Gradle with sources:

    ./gradlew wrapper --gradle-version 5.5 --distribution-type all
    

    Or you can create a custom wrapper task

    task wrapper(type: Wrapper) {
        gradleVersion = '5.5'
    }
    

    and run ./gradlew wrapper.

    0 讨论(0)
  • 2020-12-23 16:13

    ./gradlew wrapper --gradle-version=5.4.1 --distribution-type=bin

    https://gradle.org/install/#manually

    To check:

     ./gradlew tasks
    

    To input it without command:

    go to-> gradle/wrapper/gradle-wrapper.properties distribution url and change it to the updated zip version

    output:

     ./gradlew tasks
    Downloading https://services.gradle.org/distributions/gradle-5.4.1-bin.zip
    ...................................................................................
    
    Welcome to Gradle 5.4.1!
    
    Here are the highlights of this release:
     - Run builds with JDK12
     - New API for Incremental Tasks
     - Updates to native projects, including Swift 5 support
    
    For more details see https://docs.gradle.org/5.4.1/release-notes.html
    
    Starting a Gradle Daemon (subsequent builds will be faster)
    
    > Starting Daemon 
    
    0 讨论(0)
  • 2020-12-23 16:14

    Open the file gradle/wrapper/gradle-wrapper.properties in your project. Change the version in the distributionUrl to use the version you want to use, e.g.,

    distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
    
    0 讨论(0)
  • 2020-12-23 16:16

    I was facing same issue for changing default gradle version from 5.0 to 4.7, Below are the steps to change default gradle version in intellij
    1) Change gradle version in gradle/wrapper/gradle-wrapper.properties in this property distributionUrl

    2) Hit refresh button in gradle projects menu so that it will start downloading new gradle zip version

    0 讨论(0)
  • 2020-12-23 16:17

    In build.gradle add wrapper { gradleVersion = '6.0' }

    0 讨论(0)
提交回复
热议问题