
How to publish to Android
Tutorial
·
intermediate
·
+10XP
·
15 mins
·
(7)
Unity Technologies

Note: This tutorial has been updated and you can access it here.
Publishing for Android is a lot like publishing for Windows, macOS, and Linux. In certain cases, there are no required changes at all. In this tutorial, you will learn to publish applications to Android.
1. How to publish to Android
Publishing for Android is a lot like publishing for Windows, macOS, and Linux. In certain cases, there are no required changes at all. For example, a mobile game that uses a single-finger tap or drag on the screen or to interact with game elements can be accomplished with the same code as its desktop counterpart. Mobile touch input is beyond the scope of this workflow, so it’s assumed that the game is complete and ready for distribution.
2. Preparing Unity
Before Unity can build for Android, you need to install the Android support module and the Android SDK and Java SE 8 Development Kit. If you intend to target the IL2CPP scripting backend, rather than the default Mono2x, Unity also requires Revision 13b of the Android NDK. Please note that, as of September 17, 2018, these specific versions of the Java SE Development Kit and Android NDK are required. If you install a version of a development kit other than what’s required, Unity will alert you and offer to initiate the correct download.
Technical Steps:
- Download and install the Android SDK in the form of either Android Studio or the command line tools. Unity only requires the command line tools. Android Studio includes those and the latest Android API level by default, and provides a more accessible way to manage your installed SDK packages outside of Unity.
- Download and install the 64-bit version of the Java SE Development Kit 8 (JDK).
- Optionally, download and install revision 13b of the Android NDK from the NDK Archives. While the JDK and Android SDK have installers, the NDK is provided as a ZIP archive. Extract its contents, making note of the location.
- Back in the Unity Editor, from the Edit dropdown, select Preferences.
- Click External Tools on the left, and scroll down to the Android section at the bottom.
- On the first line, labeled SDK, click the Browse button to the right of the blank field. Unity will alert you that it has detected the Android SDK and ask if you want to use the SDK at that location. Select Yes.
- Repeat for the JDK on the line below.
- If using the NDK, on the third line click Browse and navigate to the extracted NDK. Click Select Folder and close the Preferences window.
3. Preparing your project
For this introduction, we will cover the basic steps necessary to prepare your project for publishing, from naming it to generating its unique signature. Finally, we’ll create the binary distribution file. Rather than .exe (Windows) or .app (macOS), Android binaries have an extension of .apk.
Technical Steps:
- In the Unity Editor, from the File dropdown, select Build Settings. In the Platforms window, select Android. If the Android support module hasn’t been installed, click the Open Download Page button to download the module and install it. If necessary, close and reopen the Build Settings window.
- Near the lower left corner, click the Player Settings button.
- In the top of the Inspector, fill out your company and product names. For final distribution, it’s recommended that you create an icon for your game to replace the default Unity launcher icon. Depending on the nature of your game, you may also wish to override the default mouse cursor. By default, the cursor hotspot is at position (0,0), the upper left corner of the cursor image. (Figure 01)

- In the bottom half of the Inspector, click on Resolution and Presentation. (Figure 02)

- Set your game’s default and allowed orientations. (Figure 03) For most purposes, “Default Orientation” is best set to Auto Rotation. Most apps and games are designed to run either in landscape or portrait mode, rather than both.

- Click Resolution and Presentation at the top of this section to close it, then click on Other Settings. (Figure 04)

- In Other Settings, for this introduction, we are only concerned with the Package Name for our mobile project. The Package Name is also known as the Application ID or bundle identifier. The bundle identifier must be unique, and cannot be reassigned to another project once the game or app has been published. Name your project and close Other Settings. (Figure 05)

- Finally, before an Android app can be distributed on the app stores, it must be signed with a unique key. Click Publishing to open that section. (Figure 06)

- A keystore is exactly what it sounds like: where keys to one or more apps are stored. If you’ve previously created a keystore, click to mark the Use Existing Keystore checkbox. Otherwise, mark Create a new keystore....
- Click the Browse Keystore button. It’s a good idea to keep the keystore separate from your projects where it will be both secure and easy to find. Navigate to the location of the new or existing keystore. If creating a keystore, give it a name and click Save. Otherwise, click on the existing keystore and click Open. For security purposes, the password is not stored with the keystore. If you lose the password, you’ll need to publish a new app with a new bundle identifier.
- Next, we’ll create a key in our keystore for our game. Under Key, click the Alias dropdown and select Create a new key. (Figure 07)

- Fill out the required information. The maximum validity for a key is 1000 years. Click Create Key. Be sure to store your keystore and passwords in a safe place. (Figure 08)

- You are now ready to create the .apk file for distribution. In the Unity Editor, from the FIle dropdown, select Build Settings. Click Android in Platforms if it’s not already highlighted, and click the Build button.
- Choose a name and location for your .apk file and click Save.
Your game is now ready for distribution. Uploading your .apk file to the app marketplace, and setting up the store page, is beyond the scope of this workflow. Please consult the help resources for those sites for assistance with that process.