Setting up Android support for the GDK
Get the dependencies for developing Android games
- Install Android build support for Unity:
- If you have not used the GDK for Unity before, please follow the steps in Setup & installation and additionally select Android build support when installing Unity.
- If you have Unity already installed and followed the Setup & installation, open your Unity Hub and add the Android build support to your existing installation.
- Install Android Studio. At the Choose Components stage of the installation, be sure to select Android Virtual Device.
- Open Android Studio and select Tools > SDK Manager.
- Select the version you intend to develop your game for.
- Select Apply to download and install the matching Android SDK version.
- (Optional) Create an Android emulator by going to Tools > AVD Manager > Create Virtual Device. Ensure you choose the same CPU architecture for your virtual machine as your development machine to get the best performance.
(Optional) Download and unzip Android NDK r16b. Our supported Unity version requires you to use NDK r16b. Older or newer versions of the NDK are not supported.
Note: This is only needed if you want to build Android using IL2CPP. Extract it to a directory of your choice. Note down the directory path as you must specify the path in your Unity Editor later.
(Optional) Install the Unity Remote app on your physical device - this is Unity’s solution for faster development iteration times.
Prepare your physical device
If you want to launch your game on a physical device, you need to:
- Ensure you have USB debugging enabled on it. See the Android developer documentation for guidance.
- Connect the mobile device to your computer using a USB cable. You might get a pop-up window on the device asking you to allow USB debugging. Select Yes.
- If you want to connect your device to a local deployment, ensure your computer and your mobile device are connected to the same network.
Set up your Unity Editor
Most of your interactions with the GDK happen inside your Unity Editor. To get started:
- Open your project inside your Unity Editor.
In your Unity Editor, go to the External Tools window. To do this:
- On Windows, go to Edit > Preferences > External Tools.
- On MacOS, go to Unity > Preferences > External Tools.
In the Android section of the External Tools window, tick the Use embedded JDK checkbox to use the JDK that Unity provides.
Input the following paths into the Android Section:
- SDK: You can find the SDK location by opening Android Studio and going to Configure > SDK Manager.
- NDK: (Optional) Use the directory path that you noted down earlier when extracting the Android NDK.
(Optional, if you want to use Unity Remote) Go to Edit > Project Settings > Editor to bring up the Editor Settings window and navigate to the Unity Remote section. Set the Device setting to Any Android Device.