Build Unity Game for Android

Build Unity Game for Android

Unity is a game engine that can be used to create 2D or 3D games for Android devices. This tutorial provides step by step how to build a Unity game for Android device.

  1. Download the Unity Hub and install it.
  2. Open the Unity Hub.
  3. Select the "Installs" tab and click "Add" button.
  4. Choose the latest official Unity release and click "NEXT" button.
Add Unity Version
  1. In the next panel select the "Android Build Support" module. Make sure that "Android SDK & NDK Tools" and "OpenJDK" are selected. Click "NEXT" button.
Add Android Build Support
  1. After the installation was completed select the "Projects" tab and click "New" button to start a new Unity project.
  2. Select 2D or 3D template. Specify the project name and location. Click "CREATE" button.
Create Unity Project
  1. Create your game. Note: for demonstration we added a Cube object in the scene.
  2. From the top menu click "File" and choose "Build Settings".
Choose Build Settings
  1. Select the "Android" platform from the list and click "Switch Platform" at the bottom of the window.
Switch Android Platform
  1. With a USB cable, connect your Android device to your computer. Make sure that USB debugging is enabled on the device.
  2. In the build settings panel click "Build And Run". You'll be asked to choose where to build APK file.
Build and Run Android APK
  1. Unity will build APK file and installs it on the device.
Unity Game Installed on Android Device

Note: When building APK you may be asked to update Android SDK. You can get the following error:

Unable to update the SDK. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed. See console log for details.

This issue can be fixed by running the SDK Manager manually:

  1. Create an empty repositories.cfg file in .android folder (e.g. C:\Users\User\.android).
  2. Open the command prompt and locate to sdkmanager.bat installation folder:
cd "C:\Program Files\Unity\Hub\Editor\2020.1.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin"
  1. Run run the sdkmanager.bat to install required Android SDK tools and platforms:
sdkmanager.bat  "platforms;android-26"
  1. Press y and accept the license.

Leave a Comment

Cancel reply

Your email address will not be published.