Developing mobile games in Unity opens up enormous opportunities, but the final stage - compiling the project for the Android platform - often causes difficulties for beginners. The process requires not only a creative approach, but also strict adherence to technical requirements, from setup Build Settings to the configuration of external tools. If you want to see your project on your smartphone screen, you have to go through several critical steps to set up your development environment.

Many developers encounter errors at the compilation stage due to missing required components or incorrect edits in the application manifest. The correct sequence of actions allows you to avoid most problems and create a working file .apk or .aab in the shortest possible time. We will analyze each step in detail so that you can focus on gameplay, and not on struggling with settings.

Preparing the development environment and installing components

Before you press the button Build, you need to make sure that your computer is equipped with all the necessary software. Unity itself does not contain all the tools for compiling for Android, so manual installation of additional modules via Unity Hubis required. Without this step, the Android tab will be inaccessible or inoperative.

You will need to install Android Build Support, which will automatically pull up the necessary dependencies, including Android SDK and NDK. Also critical is the availability of JDK (Java Development Kit), versions of which must be compatible with your version of Unity. For example, modern versions of the engine often require JDK 11 or higher, while older projects can only work with JDK 8.

Make sure that the paths to the installed tools are specified correctly in the Unity settings. Go to menu Edit โ†’ Preferences โ†’ External Tools and check the paths to Android SDK, NDK i JDK. If some paths are not defined, the system will prompt you to install them or select them manually.

โš ๏ธ Attention: Version incompatibility JDK and Unity is the most common cause of build errors. Always check the requirements for the Java version in the documentation for your engine version before starting installation.

โ˜‘๏ธ Checking the readiness of the environment

Completed: 0 / 4

Configuring build parameters in Unity

The main configuration step takes place in the window Build Settings. To open it, use the key combination Ctrl + Shift + B or go through the menu File โ†’ Build Settings. Here you will see a list of platforms, and your task is to select Android and press the button Switch Platform. This process may take several minutes as the engine recompiles internal libraries for the new architecture.

After switching platforms, you need to configure specific parameters for your project. Click on the button Player Settingsto open the detailed configuration. In the section Company Name and Product Name specify the data that will be displayed on the user's device. Pay special attention to the field Package Name: it must be unique and correspond to the format of the reverse domain, for example, com.yourstudio.gamename.

In the section Other Settings it is important to choose the right Minimum API Level. This value determines which versions of Android your game can run on. Setting a value too low can expand the audience, but will limit access to modern system functions, while setting it too high will cut off owners of older devices.

The processor architecture is also configured in this section. For modern devices, it is recommended to select ARM64, since Google Play requires support for 64-bit applications. If you plan to release the game only for testing on old gadgets, you can leave ARMv7, but this is no longer relevant for release.

๐Ÿ“Š What architecture do you choose for assembly?
Only ARM64
ARMv7 and ARM64
Only x86
I donโ€™t know what it is

Working with graphics and optimization for mobile devices

Mobile devices have limited resources compared to PCs, so porting a game requires serious graphics optimization. In the settings Quality Settings it is recommended to reduce the level of detail for mobile platforms. Use quality profiles specifically designed for smartphones to ensure stable FPS (frames per second).

Be sure to check your texture settings. In the import settings of each asset, make sure that the compression format matches the Android platform. Using the format ASTC is preferable for modern devices, as it provides a better ratio of quality and file size. For older devices, you may need ETC2.

Don't forget about the screen size and resolution. In the player options, set Default Orientation to the desired position (Portrait or Landscape) so that the game is displayed correctly when the device is rotated. You can also limit the maximum rendering resolution to reduce the load. GPU.

๐Ÿ’ก

Use the Unity Profiler tool in connected to a device mode (Active Profiler) to see the real load on the processor and memory on your smartphone, and not in the editor.

Signing the application and creating keys

To install the game on the device in debug mode a signature is not required; Unity will sign it automatically with a temporary key. However, in order to be published or transmitted to testers, a permanent signing key must be created. This process is performed through the utility Google Play or transfer to testers requires the creation of a permanent signing key. This process is performed through the utility keytoolincluded JDK.

You need to generate a keystore file (.keystore or .jks). This file will store private keys that confirm the authorship of the application. Losing this file means you won't be able to update the application in the future, so keep it in a safe place with a backup copy.

After creating the repository, return to Player Settings Unity. In the Publishing Settings section, enable the option Custom Keystore and specify the path to the created file. Enter the storage password and key alias. Now, every time you build a release version, the application will be signed with your unique certificate.

Parameter Description Importance
Keystore Key storage file (.jks) Critical for release
Alias Name of the key inside the repository Required
Password Password to access the repository Secret data
Validity Key expiration date (years) 25+ recommended

โš ๏ธ Attention: Never use the same key for different publishers or studios. If the key is compromised, it will jeopardize all your projects signed by it.

Building the project and types of output files

When all the settings have been checked, you can proceed to the actual assembly. In the window Build Settings click the button Build to create a debug version or Build And Runif a smartphone is connected to the computer via USB. The system will prompt you to select a folder to save and a file name.

There are two main file formats for Android: .apk and .aab. Format APK (Android Package Kit) is a standard installation file that can be sent directly to the user. It contains all the application code and resources in one archive.

Format AAB (Android App Bundle) is a modern standard for publishing on Google Play. It allows the store to automatically generate optimized APK files for a user's specific device, reducing download size. For local testing, APK is usually used, and for the store - AAB.

The build process can take from a few seconds to several minutes depending on the complexity of the scene and the power of the computer. In the Unity console (Window โ†’ General โ†’ Console) track progress and possible errors. If the build is completed successfully, you will receive the finished file in the specified directory.

What to do if the build is stuck?

If the build process is stuck at the "Gradle build" stage, try clearing temporary Gradle files. Close Unity, delete the Temp folder in the project and the .gradle folder in the user directory, then try again.

Installation and debugging on a real device

To install the assembled application on a smartphone, you need to enable the mode USB debuggingon it. This option is located in the Developer Options menu, which is hidden by default. To activate it, click 7 times on the build number in the โ€œAbout phoneโ€ section.

Connect the device to the computer via a high-quality USB cable. In Unity, your smartphone should appear in the list of devices to launch (Run Device). If you have chosen Build And Run, the game will automatically install and launch. If you just did the assembly, use the command adb install or the file manager on your phone.

When you run it for the first time, errors may occur related to access rights or lack of necessary permissions. Check the device logs through Logcat in Android Studio or through the built-in Unity debugging tools to identify the cause of the failure.

โš ๏ธ Attention: The developer settings interfaces and debug menus may differ depending on the smartphone manufacturer (Samsung, Xiaomi, Pixel) and the Android shell version. Check the names of the items in the official help of your device.

๐Ÿ’ก

USB debugging mode must be enabled every time you connect the phone to a new computer, otherwise Unity will not see the device to run the game.

Frequently asked questions (FAQ)

Why doesn't Unity see my connected phone?

Make sure your phone is turned on USB debugging and file transfer mode (MTP) is selected when connecting the cable. Also check if ADB drivers are installed on your computer. Try replacing the USB cable, as some cables only support charging.

What is the best minimum API Level to choose in 2026?

It is recommended to install API Level 24 (Android 7.0) or higher, so how older versions have a tiny market share and don't support many modern graphics and security features. However, if your game is very simple, you can go down to level 21.

What is the difference between Debug and Release builds?

Debug the build contains debugging information, is not optimized and has a larger size, which is convenient for finding errors. Release the build is optimized, the code is obfuscated (if configured), the size is minimal, and it is ready to be published on the store.

Is it possible to build a game for Android without installing Android Studio?

Yes, Unity can use built-in or separately downloaded SDK and NDK components without fully installing Android Studio. However, the presence of Android Studio makes it easier to work with emulators and view logs through Logcat.

What is Gradle Daemon and why does it consume a lot of memory?

Gradle Daemon is a background process that speeds up repeated project builds by storing state in RAM. If you have little RAM, you can disable it in the Gradle settings, but this will slow down the compilation process.