Gradle
Gradle Compatability
The following table shows the compatibility between Gradle version and Unity version.
Unity 2021
| Unity version | Gradle version | Android Gradle plug-in version |
|---|---|---|
| 2021.3.41f1+ | 7.5.1 | 7.4.2 |
| 2021.3.37f1 - 2021.3.40f1 | 6.7.1 | 4.2.2 |
| 2021.2.0b4 - 2021.3.36f1 2021.1.16f1+ | 6.1.1 | 4.0.1 |
| 2021.1 up to 2021.1.15f1 | 5.6.4 | 4.0.1 |
Unity 2020
| Unity version | Gradle version | Android Gradle plug-in version |
|---|---|---|
| 2020.3.15f1+ | 6.1.1 | 4.0.1 |
| 2020.3 up to 2020.3.14f1 2020.1, 2020.2 | 5.6.4 | 4.0.1 |
Unity 2019
| Unity version | Gradle version | Android Gradle plug-in version |
|---|---|---|
| 2019.4 | 5.1.1 | 3.4.3 |
Unity 2022
| Unity version | Gradle version | Android Gradle plug-in version |
|---|---|---|
| 2022.3.38f1+ | 7.5.1 | 7.4.2 |
| 2022.2.0a18 - 2022.3.37f1 | 7.2 | 7.1.2 7.1.0 |
| 2022.2.0a1 - 2022.2.0a17 2022.1 | 6.1.1 | 4.0.1 |
Unity 2023
| Unity version | Gradle version | Android Gradle plug-in version |
|---|---|---|
| 2023.1, 2023.2 | 7.6 | 7.3.1 |
For more details, refer:
Setting the correct Android Gradle Plugin version.
To setup the correct version of the Android Gradle plugin version -
-
Open baseProjectTemplate.gradle
-
Change the version of 'com.android.tools.build.gradle'

Gradle build failure.
While building if you get Gradle Build failure, you will get multiple error logs in the unity console. There can be multiple reasons why you are getting these errors.
To get the reason you need to refer to CommandInvocationFailure in Build failed logs

#1 Error: uses-sdk:minSdkVersion 'x' cannot be smaller than version 28 declared in library

JMRSDK has a dependency on SDK version 28 and hence build will fail when the minimum API version specified in project settings will be smaller than version 28.
Fix: Make sure that the minimum API level is set to 28 and the target API level is set to 34.

#2 Error: Could not get unknown property 'vstsMavenAccessToken' for Credentials [username: tesseractimg].

There are dependencies of the Gradle properties template on the base Gradle template.
Fix: Make sure to select all the publishing build settings correctly as shown in the image below.

#3 Error: Keystore passwords incorrect


This document does not cover manifest merger failure due to multiple manifest files injected due to third-party plugins.