Menu

Update Gradle

Unity updates Gradle and Gradle plugin (for Android)


2. Please follow Correspondence between Gradle Plugin and Gradle Find the Gradle version corresponding to the Gradle plugin you want to use< /p>

Note: Assumes using For Gradle plugin version 3.5.4, the corresponding Gradle version is 5.4.1

3. Please go to Gradle download address Download the compressed package of the corresponding Gradle version(Click complete to download, assuming you are downloading version 5.4.1 of Gradle)

4. After the Gradle compressed package is downloaded, unzip it to get the gradle-* folder (assuming you downloaded 5.4. 1 version of Gradle, decompress it to get the gradle-5.4.1 folder)

5. Find your gradle directory , this directory is located under your Unity Editor installation path: \Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle< /span>, back up the lib folder in the gradle directory and delete it

6. Unzip the downloaded Gradle compressed package into the gradle-* directory Copy and paste the lib folder into the gradle directory (assuming you downloaded version 5.4.1 of Gradle, then unzip the gradle-5.4 Copy and paste the lib folder in the .1 directory into the gradle directory)

7. If you are using Unity Editor2019 and For the above version, please find the baseProjectTemplate.gradle file in your project (generated through the options in the picture below , can be ignored if this option is not available in your Editor) and the LauncherTemplate.gradle file
If you are using Unity Editor2018 and below, please find the mainTemplate.gradle file

In the gradle file found, modify the version of the Gradle plugin to the version you want to use. The following is an example, change 3.2.0 to the Gradle plugin version you want to use (assuming that the Gradle plugin version 3.5.4 is used, then Change 3.2.0 to 3.5.4)

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
**BUILD_SCRIPT_DEPS**}
}
...

8. Restart Unity Editor and build. The update has been completed

Last modified: 2025-05-30Powered by