How to change Gradle version for project?

I’ve had this issue for quite some time and i found the answer. (at least for me)
I was trying to package my game from Unreal 4.23 into Android. And i got the same error as you.

The reason being is that Gradle for some reason deprecated the older version that comes along with this Unreal Engine. And the solution is that you need to go and change the build.grade file.

I am assuming that the file itself is not created by default, but only when you start to package a project (but i could be wrong).

– Solution –
Note: pick your Engine version folder. Mine is UE_4.23
File location C:\Program Files\Epic Games\UE_4.23\Engine\Build\Android\Java\gradle
Solution: you change the content inside the build.gradle file with this


buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3' // Update to a more recent version of the Android Gradle plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

doing this you give gradle the new supported versions of itself and the error should go away and you can build your project without any issues!

Also if you want to check/change your gradle version, you can do so here:
C:\Program Files\Epic Games\UE_4.23\Engine\Build\Android\Java\gradle\gradle\wrapper
and open the gradle-wrrapper.properties with Notepad and see what version it’s pulling from the web, you can change this but bear in mind what version you pick. For UE 4.23 i picked 6.5 and it works just fine

NOTE: Changing the gradle-wrrapper.properties inside the PROJECT itself will not work cause the main file is in the main engine folder mentioned above, so for the best results change it there!

– Additional Information –

Also for the sake of it, I will leave my SDK/NDK/JDK versions here:

to check this, open your project go to Edit>Project Settings, in the search bar type: SDK and all the settings for it should come up

Minimum SDK version: 9
Target SDK version: 27
SDK: 28.0.3
NDK: r16b (you can also use r14b)
JDK: 1.8.0_77
SDK API Level: matchndk
NDK API Level: latest

To get these SDK/NDK/JDK version without too much issues, there is a program that’s waiting to be installed called CodeWorksforAndroid that comes with unreal and it will install all of these files for you, but you have to install it first and it will create the NVPACK folder which contains all the supported SDK, NDK and JDK.

The location of the installation file:
C:\Program Files\Epic Games\UE_4.23\Engine\Extras\AndroidWorks\Win64\CodeWorksforAndroid-1R7u1-windows.exe

Launch it, select what you need and (by default) the installation should create a folder in your main drive (C: for me in this case) like so:
C:NVPACK

And voila, you will have all of the already supported SDK/NDK/JDK versions already there for you to select inside the project settings and make use off and they are all supported for U.E 4.23.

So to sum it up.
If you changed the build.gradle file, and have selected the supported SDK/NDK/JDK versions, you should be able to package your android project without any errors regarding Gradle!

Hope it helps, I spent HOURS trying to resolve this until i did! So let me know if it works. Happy game deving!

1 Like