Skip to main content

Gradle

Gradle Compatability

The following table shows the compatibility between Gradle version and Unity version.

Unity 2021

Unity versionGradle versionAndroid Gradle plug-in version
2021.3.41f1+7.5.17.4.2
2021.3.37f1 - 2021.3.40f16.7.14.2.2
2021.2.0b4 - 2021.3.36f1
2021.1.16f1+
6.1.14.0.1
2021.1 up to 2021.1.15f15.6.44.0.1

Unity 2020

Unity versionGradle versionAndroid Gradle plug-in version
2020.3.15f1+6.1.14.0.1
2020.3 up to 2020.3.14f1
2020.1, 2020.2
5.6.44.0.1

Unity 2019

Unity versionGradle versionAndroid Gradle plug-in version
2019.45.1.13.4.3

Unity 2022

Unity versionGradle versionAndroid Gradle plug-in version
2022.3.38f1+7.5.17.4.2
2022.2.0a18 - 2022.3.37f17.27.1.2
7.1.0
2022.2.0a1 - 2022.2.0a17
2022.1
6.1.14.0.1

Unity 2023

Unity versionGradle versionAndroid Gradle plug-in version
2023.1, 2023.27.67.3.1

For more details, refer:

Unity Android Gradle Overview

Setting the correct Android Gradle Plugin version.

To setup the correct version of the Android Gradle plugin version -

  1. Open baseProjectTemplate.gradle

    Open baseProjectTemplate.gradle

  2. Change the version of 'com.android.tools.build.gradle'

Change Gradle version

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.

info

To get the reason you need to refer to CommandInvocationFailure in Build failed logs

CommandInvocationFailure in unity console

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

SDK version error

info

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.

API level settings

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

Gradle properties error

info

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.

Publishing build settings

#3 Error: Keystore passwords incorrect

Project Keystore incorrect

Project Key password was incorrect

warning

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