Gradle テンプレートは、Gradle で Android アプリケーションをビルドする方法を設定します。各 Gradle テンプレートは 1 つの Gradle プロジェクトを表します。Gradle プロジェクトは他の Gradle プロジェクトを含むことや、他の Gradle プロジェクトに依存することができます。
Gradle テンプレートは以下のファイルで構成されています。
ファイル | 場所 | 含まれるもの |
---|---|---|
baseProjectTemplate.gradle |
エクスポートしたプロジェクトの root/build.gradle フォルダー |
最終的な Gradleプロジェクトのすべてのモジュールに影響する設定情報が含まれています。どの Android Gradle Plugin のバージョンを使用するか、また java プラグインの場所を指定します。場所は、このプロジェクト内のオンラインレポジトリと java プラグインの組み合わせです。 |
launcherTemplate.gradle |
エクスポートしたプロジェクトの root/launcher/build.gradle folder フォルダー |
Android アプリケーションのビルド方法 (バンドル、署名、APK 分割) のインストラクションが含まれています。unityLibrary プロジェクトに依存し、.apk ファイルまたはアプリケーションバンドルを出力します。 |
mainTemplate.gradle |
エクスポートしたプロジェクトの root/unityLibrary/build.gradle フォルダー |
Unity をライブラリにしてビルドする方法のインストラクションが含まれます。 .aar ファイルを出力します。Unity エディターで Unity テンプレートをカスタムテンプレートでオーバーライドできます。詳細は、このページのカスタムの Gradle ビルドテンプレートの提供についてを参照してください。 |
libTemplate.gradle |
任意 |
Android Library Project プラグインに build.gradle ファイルが含まれていない場合、Unity は libTemplate.gradle ファイルをテンプレートとして使用し、ファイルを生成します。Unity が build.gradle ファイルを生成した後、またはプラグインのディレクトリに既に存在する場合、Unity はプラグインを Gradle プロジェクトへコピーします。 |
settingsTemplate.gradle |
エクスポートしたプロジェクトの root/settings.gradle ファイル |
Gradle ビルドシステムがプロジェクトをビルドするときに含むべきモジュールの名前を指定します。Unity テンプレートを Unity エディターのカスタムテンプレートで上書きすることができます。詳細については、このページのカスタム Gradle ビルドテンプレートの提供についてを参照してください。 |
gradleTemplate.properties |
エクスポートしたプロジェクトの root/gradle.properties ファイル |
Gradle ビルドシステムを設定し、Java 仮想マシン (JVM) ヒープ のサイズなどのプロパティを指定します。 |
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.
To modify the Gradle project after Unity assembles it, create a class that implements the OnModifyAndroidProjectFiles method in the AndroidProjectFilesModifier abstract class. This method receives a C# object representing the Gradle project files. For more info about Android Project Configuration manager see Modify Gradle project files with Android Project Configuration Manager
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.