Skip to main content

Gradle

Gradle Compatability

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

Unity versionGradle versionAndroid Gradle Plugin version
2023.1, 2023.27.67.3.1
2022.2, 2022.37.27.1.0
2022.1
2021.2, 2021.3
2021.1 starting from 2021.1.16f1
2020.3 starting from 2020.3.15f1
6.1.14.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.44.0.1
2019.45.1.13.4.3

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

  2. 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.

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

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.

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

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.

#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.