Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Gradle template variables

Reference documentation for the variables you can use in custom Gradle template files.
Read time 4 minutesLast updated 14 days ago

You can use the following variables in custom Gradle template files:

Variable

Description

ABIFILTERSSpecifies the Application Binary Interfaces (ABIs) that your application should support. For example,
armeabi-v7a
,
arm64-v8a
. Gradle creates application builds for the specified
ABIFILTERS
values only.
APIVERSIONThe API version to build for. Unity sets the APIVERSION and TARGETSDK to the same value (Target API Level in the Android Player Settings).
APPLICATIONIDAndroid Application ID. For example,
com.mycompany.myapp
.
APPLY_PLUGINSSpecifies a list of Gradle plug-ins to use during the build process.
BUILDTOOLSThe SDK build tools to use.
BUILD_SCRIPT_DEPSSpecifies a list of dependencies and repositories required during the build process.
BUILTIN_NOCOMPRESSSpecifies a default list of file extensions to exclude from compression. The file extensions are:
.unity3d
,
.ress
,
.resource
,
.obb
,
.bundle
,
.unityexp
.
DEBUGSYMBOLLEVELIndicates the type of symbols package that contains debug metadata required for debugging your application. You can set the values to none for no debug metadata, symbol_table for symbols package with only symbol tables, or full for symbols package with symbol tables and debugging information.
DEFAULT_CONFIG_SETUPIncludes additional configuration components for
android.defaultConfig
.
DEPSThe list of project dependencies. This is the list of libraries that the project uses.
DIR_GRADLEPROJECTThe directory where Unity creates the Gradle project.
DIR_UNITYPROJECTThe directory of your Unity project.
EXTERNAL_SOURCESThe build script required to produce build artifacts such as, GameActivity and Swappy native libraries.
GOOGLE_PLAY_DEPENDENCIESSpecifies the Google Play services your application requires. For example,
com.google.android.gms:play-services-ads:23.2.0
.
IL_CPP_BUILD_SETUPThe build script required to produce build artifacts related to IL2CPP, such as
libil2cpp.so
.
LAUNCHER_SOURCE_BUILD_SETUPUnity’s internal build script.
LIBSDKTARGETThe target API level the Unity library supports.
MINIFY_DEBUGIndicates whether to minify debug builds.
MINIFY_RELEASEIndicates whether to minify release builds.
MINSDKThe minimum API version that supports the application.
NAMESPACEThe application namespace. For example,
com.MyCompany.MyApp
.
NDKPATHSpecifies the Android Native Development Kit (NDK) installation folder path set in the Android section of External Tools, menu: Edit > Preferences > External Tools (macOS: Unity > Settings > External Tools).
NDKVERSIONThe Android NDK (Native Development Kit) version Unity is using. For example,
ndkVersion "27.2.12479018"
.
PACKAGINGSpecifies the required APK packaging options.
PLAY_ASSET_PACKSSpecifies the asset packs to include in your application.
SIGNComplete the
signingConfigs
section if this build is signed.
SIGNCONFIGIndicates whether the build is signed. If this property is set to
signingConfig.release
, the build is signed.
SOURCE_BUILD_SETUPUnity's internal build script.
SPLITSIndicates whether your application supports multiple APK builds.
SPLITS_VERSION_CODEBuild script that sets version code for split APKs.
TARGETSDKThe API version to target. Unity sets the and APIVERSION to the same value (Target API Level in the Android Player Settings).
USER_PROGUARDSpecifies a custom ProGuard file to use for minification.
VERSIONCODEThe internal version number for the application. It’s used to indicate how recent the application version is, where higher number denotes a more recent version.
VERSIONNAMEThe application version number expressed as a string. This version number is visible to the users.
Custom
settingsTemplate.gradle
files can also contain the following variables:

Variable

Description

INCLUDESThe list of Android Library plug-ins to include in the Gradle project.
ARTIFACTORYREPOSITORYAdds a reference to Unity's maven repository only for internal use. Unity deletes this during the build process.
Custom
gradleTemplate.properties
files can also contain the following variables:

Variable

Description

ADDITIONAL_PROPERTIESContains additional properties for the application. This includes:
• The Gradle template version.
• The path to the Unity project.
• If the application uses the Android App Bundle publishing format, a flag that indicates to keep native libraries compressed.
• If the application uses the GameActivity application entry point, a flag that indicates to use AndroidX.
JVM_HEAP_SIZEThe maximum size of the Java virtual machine (JVM) heap.
STREAMING_ASSETSThe list of files in the Steaming Assets folder that Gradle shouldn't compress.

Additional resources