To have some control over the format and contents of Gradle project files, you can override Unity’s default templates with your own custom template. To do this:
To verify that your template modifications give the result that you expect, export your project and view the final Gradle project files in the resulting project.
以下の変数をカスタム Gradle テンプレートファイルで使用できます。
変数 | 説明 |
---|---|
DEPS | プロジェクト依存関係のリスト。プロジェクトが使用するライブラリのリスト。 |
APIVERSION | ビルドする API バージョン。Unity はこれと TARGETSDKVERSION を同じ値 (Android Player Settings の Target API Level) に設定します。 |
MINSDKVERSION | アプリケーションをサポートする API の最低バージョン。 |
BUILDTOOLS | 使用する SDK ビルドツール。 |
TARGETSDKVERSION | ターゲットとする API バージョン。Unity はこれと APIVERSION を同じ値 (Android Player Settings の Target API Level) に設定します。 |
APPLICATIONID | Android アプリケーション ID (例えば com.mycompany.myapp) |
MINIFY_DEBUG | デバッグビルドを小さくするかどうかを示します。 |
PROGUARD_DEBUG | デバッグビルドの小型化のために ProGuard を使用するかどうかを指定します。 |
MINIFY_RELEASE | リリースビルドを小型化するかどうかを示します。 |
PROGUARD_RELEASE | リリースビルドの小型化のために ProGuard を使用するかどうかを指定します。 |
USER_PROGUARD | 小型化に使用するカスタム ProGuard ファイルを指定します。 |
SIGN | このビルドが署名されている場合は、signingConfigs セクションを行ってください。 |
SIGNCONFIG | ビルドが署名されているかどうかを示します。このプロパティが signingConfig.release に設定されている場合、ビルドは署名されています。 |
DIR_GRADLEPROJECT | Unity が Gradle プロジェクトを作成するディレクトリ。 |
DIR_UNITYPROJECT | Unity プロジェクトのディレクトリ。 |
PLAY_ASSET_PACKS | アプリケーションに加える アセットパック を指定します。 |
BUILTIN_NOCOMPRESS | Specifies a default list of files extensions to not compress. The file extensions are: .unity3d , .ress , .resource , .obb , .bundle , .unityexp . |
カスタムの settingsTemplate.gradle
ファイルには、以下の変数を加えることもできます。
変数 | 説明 |
---|---|
INCLUDES | Gradle プロジェクトに含む Android ライブラリプラグインのリスト。 |
カスタムの gradleTemplate.properties
ファイルには、以下の変数を加えることもできます。
変数 | 説明 |
---|---|
JVM_HEAP_SIZE | Java 仮想マシン (JVM) ヒープ](https://www.ibm.com/docs/en/integration-bus/10.0?topic=development-jvm-heap-sizing) の最大サイズ。 |
STREAMING_ASSETS | Steaming Assets フォルダーにある、Gradle が圧縮すべきでないファイルのリスト。 |
ADDITIONAL_PROPERTIES | Contains 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. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.