Version: 2019.2
Android 用ゲームの開発について
Unity Remote

Android 環境の設定

Android 用にビルドして実行するには、Unity Android Build Support プラットフォームモジュールをインストールする必要があります。Android デバイスで コードをビルドして実行するには、 Android Software Development Kit (SDK) と Native Development Kit (NDK) もインストールする必要があります。デフォルトで、Unity は OpenJDK に基づく Java Development Kit をインストールします。

1. Android Build Support と Android SDK & NDK ツールをインストールします。

Use the Unity Hub to install Android Build Support and the required Android SDK & NDK tools. You can also install Android OpenJDK as a separate, optional component.

Android モジュールを加える
Android モジュールを加える

You can install Android Build Support and the Android SDK & NDK tools when you install the Unity Editor, or add them at a later time.

Android モジュールの追加については、以下を参照してください。

If you are using a 2018 version of Unity, see the Unity 2018.4 documentation for information on manually installing the Android SDK and NDK.

2. デバイスの USB デバッグを有効にする

USB デバッグを使用できるようにするには、開発者向けオプションを有効にする必要があります。そのためには、デバイスの 設定__ で “ビルド番号” を探します。ビルド番号がどこにあるかは、デバイスによって異なります。Android 設定は通常、設定__ > 端末情報 > ビルド番号 の順に選ぶと表示されます。デバイスと Android バージョンに関する特有の情報は、ハードウェア製造会社の情報を参照してください。

上記の説明にしたがってビルド番号を捜したら、ビルド番号を 7 回タップします。タップするたびに小さなポップアップ画面に「デベロッパーになるまであと X ステップです。」と表示され、X が残りのタップの回数のカウントダウンになります。7 回目のタップで開発者向けオプションがアンロックされます。

ノート: バージョン 4.2 (Jelly Bean) より古い OS では、開発者向けオプションはデフォルトで有効になっています。

Settings > Developer options に移動し (または、デバイスによっては Settings > System > Developer options)、USB debugging チェックボックスを有効にします。USB でコンピューターに接続すると、Android はデバッグモードになります。

デバイスを USB ケーブルでコンピューターに接続します。Windows コンピューターで開発する場合は、使用するデバイス用の USB ドライバーをインストールする必要があります。詳細は、デバイスの製造会社のウェブサイトを参照してください。

設定手順は Windows と macOS では異なり、詳細は Android developer ウェブサイトに説明されています。Android デバイスを SDK に接続する詳しい情報は、Android デベロッパードキュメントの アプリを実行する のセクションを参照してください。

Using an alternate Java Development Kit, Android SDK, or NDK

Unity recommends that you use the Unity Hub to install Android SDK & NDK tools, to ensure that you receive the correct versions and configuration. Unity installs Android SDK & NDK tools respectively in the SDK and NDK folders under /Unity/Hub/Editor/[EditorVersion]/Editor/Data/PlaybackEngines/AndroidPlayer/.

If you manually install the Android SDK & NDK tools in another location, and you do not want to duplicate the installation, you can specify the location in the Unity Preferences window. To do this, go to Preferences > External tools and enter the directory paths in the SDK and NDK fields:

Android の外部ツール設定を示す Preferences ウィンドウ
Android の外部ツール設定を示す Preferences ウィンドウ

Warning: Unity does not officially support versions of the JDK, SDK, or NDK other than the ones it supplies.

To change the JDK, SDK, or NDK that Unity uses to build Android apps:

  1. プロジェクトを開きます。
  2. Preferences ウィンドウを開きます (Windows と Linux: Edit > Preferences、macOS: Unity__ > Preferences)。
  3. 左側のナビゲーションペインで External Tools を選択します。

Change the JDK

  1. JDK Installed with Unity (recommended) のチェックを外します。
  2. In the JDK field, enter the path to the JDK or use the Browse button to locate it.

Change the SDK

  1. Android SDK Tools Installed with Unity (recommended) のチェックを外します。
  2. In the SDK field, enter the path to the SDK or use the Browse button to locate it.

Unity は、Unity バージョンのリリース時に入手可能な Android SDK の最新バージョンで動作します。

Change the NDK

  1. Android NDK Installed with Unity (recommended) のチェックを外します。
  2. In the NDK field, enter the path to the NDK or use the Browse button to locate it.

Unity の各バージョンには、Android NDK の特定のバージョンをインストールする必要があります。

Unity バージョン NDK バージョン
2017.4 LTS r13d
2018.4 LTS r16b
2019.1 r16b
2019.2 r16b
2019.3 r19

  • 2019–07–01 Page amended
  • 2018–11–21 Page amended
Android 用ゲームの開発について
Unity Remote