ドキュメント

Unity Engine

Download Unity

Unity Engine

Gradle templates reference

Explore the Gradle templates you can use to configure how Unity builds Android applications.
読み終わるまでの所要時間 2 分最終更新 2ヶ月前

Gradle templates configure how to build an Android application using Gradle. Each Gradle template represents a single Gradle project. Gradle projects can include, and depend on, other Gradle projects.

Gradle template files

A Gradle template consists of the following files:

File

Location

Description

baseProjectTemplate.gradle
In the exported project,
root/build.gradle
file
Specifies configuration information that affects all modules in the final Gradle project, including which Android Gradle Plugin version to use and the locations of Java plugins. These locations are a combination of online repositories and Java plugins inside this project.
launcherTemplate.gradle
In the exported project,
root/launcher/build.gradle
file
Provides instructions for building the Android application, including bundling, signing, and whether to split the APK. Depends on the
unityLibrary
project and outputs either an .apk file or an app bundle.
mainTemplate.gradle
In the exported project,
root/unityLibrary/build.gradle
file
Provides instructions for building Unity as a Library, and outputs an .aar file. You can override the Unity template with a custom template in the Unity Editor. For more information, refer to the Modify Gradle project files with Gradle template files.
libTemplate.gradle
VariesIf an Android Library plug-in doesn't include a
build.gradle
file, Unity uses the
libTemplate.gradle
file as a template to generate one. After Unity generates the
build.gradle
file, or if one already exists in the plug-in's directory, Unity copies the plug-in into the Gradle project.
settingsTemplate.gradle
In the exported project,
root/settings.gradle
file
Specifies the names of modules that the Gradle build system should include when it builds the project. You can override the Unity template with a custom template in the Unity Editor. For more information, refer to the Modify Gradle project files with Gradle template files.
gradleTemplate.properties
In the exported project,
root/gradle.properties
file
Configures the Gradle build system and specifies properties such as the size of the Java virtual machine (JVM) heap.
To have more control over the Gradle project files that Unity produces, you can override Unity's default Gradle template files. For information on how to do this, refer to Modify Gradle project files with Gradle template files.

Additional resources