Version: 2023.1
Language : English
Modify Gradle project files with Android Studio
Android Build Settings

Android Templates Upgrader window reference

The Android Templates Upgrader window is a tool that upgrades Gradle template files to use the Android Project Configuration Manager. To do this, it takes the GradleAn Android build system that automates several build processes. This automation means that many common build errors are less likely to occur. More info
See in Glossary
template files in your project and creates a new C# script that uses the Android Project Configuration Manager API to make the same Gradle project file modifications as the Gradle template files. It then disables the Gradle template files.

To open the Android Templates Upgrader window:

  1. Open Android Player Settings.
  2. Go to Publishing Settings > Build.
  3. Select Upgrade templates to C#.

Tip: It’s best practice to use this window as a one-time upgrade path. After you upgrade your Gradle template files, you should use the new C# script and the Android Project Configuration Manager API to make any further Gradle project file modifications.

Property Description
Custom Main Manifest Indicates whether to upgrade your Main Manifest template file.
This property is visible only when you enable Custom Main Manifest in Player SettingsSettings that let you set various player-specific options for the final game built by Unity. More info
See in Glossary
.
Custom Launcher Manifest Indicates whether to upgrade your Launcher Manifest template file.
This property is visible only when you enable Custom Launcher Manifest in Player Settings.
Custom Main Gradle Template Indicates whether to upgrade your Main Gradle template file.
This property is visible only when you enable Custom Main Gradle Template in Player Settings.
Custom Launcher Gradle Template Indicates whether to upgrade your Launcher Gradle template file.
This property is visible only when you enable Custom Launcher Gradle Template in Player Settings.
Custom Base Gradle Template Indicates whether to upgrade your Base Gradle template file.
This property is visible only when you enable Custom Base Gradle Template in Player Settings.
Custom Gradle Properties Template Indicates whether to upgrade your Gradle Properties template file.
This property is visible only when you enable Custom Gradle Properties Template in Player Settings.
Custom Gradle Settings Template Indicates whether to upgrade your Gradle Settings template file.
This property is visible only when you enable Custom Gradle Settings Template in Player Settings.
Upgrade Templates Upgrades the selected Gradle template files to use the Android Project Configuration Manager API. The upgrade process creates a new C# script that makes the same Gradle project file modifications as the selected Gradle template files. If the upgrade process succeeds, the window displays the path to the new C# script. If the upgrade process fails, the window displays an error.
This button is interactive when you select at least one custom Gradle template file to upgrade.

When the upgrader disables custom Gradle template files, it doesn’t delete them. This means that if you later want to use the Gradle template files again, you can delete the generated C# script and re-enable the relevant custom Gradle template options in Android Player Settings. This re-enables your Gradle template files which still perform the same modifications as they did before you ran the upgrader.

If you run the upgrader multiple times it creates a backup of the previously generated C# script. The backup is in the same directory and has the same name as the newly generated C# script. To differentiate the backup from the newly generated C# script, the file extension for the backup is .cs.BACKUP.

Warning: Successive runs of the upgrader override the backup. This means if you make any changes in the backup file then run the upgrader, these changes will be lost.

Warning: If you use single quotes to define values for string properties in the gradle templates, these properties will use double quotes when exported to the Gradle project.

Warning: Unity supports two application entry points: Activity and GameActivity. If the file you want to upgrade contains modifications specifically for one entry point, but you don’t enable that entry point, the generated C# script won’t affect the disabled activity. The result is that the final AndroidManifest.xml won’t include the modifications.

For example, if your template contains modifications specifically for the Activity application entry point, the template upgrader generates a script that also specifically modifies Activity. If you later switch to the GameActivity application entry point, the modifications have no effect.

Additional resources

Modify Gradle project files with Android Studio
Android Build Settings