Change version of Gradle to 4.6

I’ve found that Unity whenever it builds using Gradle system it uses it’s own Gradle version right now it’s 4.0.1 being used.

But I would like to use my own version of gradle which is 4.6 (I don’t want to depend on Unity setting up the version of gradle easier to have more control on this on my side)

I couldn’t find anything to work as wrapper version seems that is not being used.


Example of the command that is using Unity :

CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_144\bin\java.exe -classpath “C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx2048m” “assembleDebug”

Any Ideas ? Thanks !

Did you ever find a solution to this? Hitting this issue as well

@adrianrenji @KBaxtrom-LevelEx

Download your preferred gradle version: Gradle | Releases

Swap the lib folder in Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib with the lib folder in the downloaded zip folder.

I also ran into gradle/JDK compatibility issues while solving this issue. I had to download JDK 8 and use it instead of 9.

solved it after plenty hours of searching, installing, and uninstalling stuff: Here is what worked for me
1: OS: Windows
2: Unity version 2017.4.23.1f1
3. JDK version: jdk-8u171-windows-x64
4. NDK : android-ndk-r13b

Getting a bit technical :slight_smile:
-Update your SDK build tools upto 28.0.3.(must using SDK manager due to license issues: otherwise unity creates bug while building)
-Change JAVA_HOME Environment variable (folder with installed JDK, usually C:\Program Files\Java\jdk1.8.0_171)
-Update JDK path in edit/preferences/external Tools (same as JAVA_HOME Environment variable path).

  • Build an empty project and check if it works?
  • If it doesen’t work, Delete .gradle folderfrom file from c/users/Username
  • and build your project, make sure you are connected to internet this time as Unity will download .gradle file itself.(this will take a bit long time depending on speed of your internet connection).
  • and sorry for my english :-