Gradle
Gradle Compatability
The following table shows the compatibility between Gradle version and Unity version.
Unity version | Gradle version | Android Gradle Plugin version |
---|---|---|
2023.1, 2023.2 | 7.6 | 7.3.1 |
2022.2, 2022.3 | 7.2 | 7.1.0 |
2022.1 2021.2, 2021.3 2021.1 starting from 2021.1.16f1 2020.3 starting from 2020.3.15f1 | 6.1.1 | 4.0.1 |
2021.1 up to and including 2021.1.15f1 2020.1, 2020.2 2020.3 up to and including 2020.3.14f1 | 5.6.4 | 4.0.1 |
2019.4 | 5.1.1 | 3.4.3 |
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.