The development of mobile applications has ceased to be the lot of select programmers who write native code in Java or Kotlin. The modern engine Unity allows you to create cross-platform solutions with high performance using the language C#. If you are wondering how to make an application using Unity for Android, then you are on the right track: this tool has a powerful set of tools for porting projects to mobile devices.
The process begins long before you press the โBuildโ button. You have to set up the environment, deal with dependencies and understand how your logic will work on the limited resources of the smartphone. Donโt be intimidated by the abundance of settings - we will analyze every stage from installing the software to the final compilation of the APK or AAB file.
In this article we will go through the entire path of creating a build, paying special attention to critical settings that beginners often miss. The correct configuration of the project will save you hours of debugging and prevent application crashes for end users on real devices.
Preparing the environment and installing modules
The first step is to install the Unity Hub engine itself and the required version of the editor. However, to work with Android it is not enough to simply download Unity. You will need to install the module Android Build Support via Hub. Without this component, the build button will be inactive, and the project will not be able to compile for the ARM architecture.
When installing the module, make sure that additional packages are selected: Android SDK & NDK Tools and OpenJDK. While it is possible to use external paths to these tools, the built-in versions ensure maximum compatibility with the specific version of your Unity editor. This will eliminate errors of compiler version mismatches.
After installation, check that the paths to the SDK and NDK are entered correctly in the editor settings. Go to Edit โ Preferences โ External Tools. Here you will see fields for specifying paths. If you used the Unity installation module, the checkboxes should be checked automatically, and the paths will lead to the internal folders of the engine.
โ ๏ธ Attention: Make sure that there are no Cyrillic characters or spaces in the path to the folder with the project or SDK. This is a common cause of compilation errors that are difficult for a beginner to diagnose.
โ๏ธ Checking the SDK installation
Project setup and player parameters
When the environment is ready, you need to correctly configure the project itself. Go to File โ Build Settings and switch the platform to Androidby clicking the Switch Platformbutton. This process may take time, as the engine recompiles assets for the new target architecture.
Next, open the window Player Settings. Here are the key parameters of your future application. In the section Other Settings be sure to specify Package Name in the reverse domain format (for example, com.company.game). This is a unique identifier that cannot be changed after publication on Google Play.
Also in this section you must select the minimum API version (Minimum API Level). It is recommended to set the value to at least Android 7.0 (API Level 24) in order to cover the majority of active devices, but at the same time weed out completely outdated models. For Target API Level Always select the latest available value to meet store requirements.
| Parameter | Recommended value | Description |
|---|---|---|
| Package Name | com.yourname.appname | Unique application ID |
| Minimum API Level | Android 7.0 'Nougat' (API level 24) | Lower compatibility limit |
| Target API Level | Latest installed (Android 14/15) | Target version for optimization |
| Scripting Backend | IL2CPP | Provides better performance |
An important aspect is the choice of backend scripts. Switch Scripting Backend from Mono to IL2CPP. This will significantly improve the performance of the code and reduce the size of the final file, although compilation time will increase. For mobile devices, this is the industry standard.
Use IL2CPP for final releases. It provides better code protection against reverse engineering and faster execution speed compared to Mono.
Optimize graphics and resources
Mobile devices have limited processing power and heat dissipation. To prevent your application from turning your smartphone into an oven and draining the battery in 20 minutes, proper optimization is necessary. Start by adjusting the graphics quality in Project Settings โ Quality.
Remove unnecessary quality levels, leaving only 2-3 profiles for mobile devices (Low, Medium, High). Turn off heavy effects like complex shadows or post-processing on low settings. Use Texture Compression ASTC format, which provides the best quality-to-size ratio for modern GPUs.
Keep track of the number of polygons in your models and the number of draw calls (Draw Calls). Use batching (Static and Dynamic Batching) to combine objects with the same materials. This reduces the CPU load when preparing frames for rendering.
โ ๏ธ Attention: Do not use 4K resolution textures for mobile interfaces or small objects. This wastes the device's RAM and can cause the application to crash on weak smartphones.
To analyze performance, use the built-in profiler. Run the application on a real device in development mode and connect the profiler via USB. This will show bottlenecks in the code or rendering that are not visible in the editor.
Input control and touch interface
The transition from PC to mobile platform requires a complete overhaul of the control system. Keyboards and mice are being replaced by touch screens. In Unity, the system Input System or the old Input Manager is used for this, but for new projects the new system is highly recommended.
You need to add a component to the scene EventSystemif it does not exist, and configure the UI elements so that they respond to touches (Pointer Click). To control your character in 3D, create virtual joysticks or swipe zones.
Don't forget about multi-touch. The player can simultaneously press the jump button and rotate the camera. Your logic must correctly handle multiple simultaneous touches. Test scenarios where fingers overlap or extend beyond on-screen buttons.
// Example of a simple touch handler for movementvoid Update() {
if (Input.touchCount > 0) {
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved) {
// Camera or character movement logic
Vector2 delta = touch.deltaPosition;
transform.Rotate(-delta.y, delta.x, 0);
}
}
}
Also consider different screen aspect ratios. From ultra-wide modern flagships to older 4:3 tablets. Use Canvas Scaler in mode Scale With Screen Size and set the reference resolution so that the interface looks equally good on all devices.
How to test multi-touch in the editor?
In the Game window, enable multi-touch simulation. Now you can emulate a second touch by holding down the Ctrl key (or Cmd on Mac) and moving the mouse while holding down the left button.
Building an APK and signing with a key
When the project is optimized and configured, the moment of truth comes - the build. In the Build Settings window, select a build type. Suitable for testing and debugging Development Build with the option enabled Script Debugging. This will allow you to connect to the code directly from your phone.
To publish on Google Play, you will need a file in the format .aab (Android App Bundle), and not the good old APK. Google requires this format for all new applications, as it allows the store to generate optimized packages for a specific user device.
A critical step is creating a signing key (Keystore). Without it, you won't be able to update your app in the future. Go to Player Settings โ Publishing Settings and create a new kystore. Write down your password and data in a safe place!
โ ๏ธ Attention: Losing your signing key means you'll never be able to release an update to your app under the same package name. You will have to create a new application from scratch.
After setting the key, click the button Build. Select a folder to save. The compilation process can take anywhere from a few minutes to an hour depending on the power of your PC and the complexity of the project. Upon completion, you will receive a ready-made file for installation.
Always create a backup copy of the Keystore file and remember your passwords. This is the only digital key to updating your product in the store.
Testing on real devices
Emulators are useful for quickly testing logic, but they do not provide insight into real-world performance. Be sure to test the application on physical devices. Connect your smartphone via USB, enable Developer mode and USB debugging.
Unity will automatically detect the connected device in the list of platforms for the build. You can click Build And Runto immediately install the application on your phone after compilation. This speeds up development iterations significantly.
Pay attention to working with notifications, minimizing the application and restoring state. Mobile operating systems manage memory aggressively: if the user minimizes the game and the system decides to unload it from RAM, when returning the application should resume working correctly and not crash.
Check it on different versions of Android. The behavior of the permissions system (camera, microphone, storage) is different on Android 10, 12 and 14. Make sure that your permission request occurs at the right time and that the user's refusal is processed.
Frequently asked questions (FAQ)
Why does the application crash immediately after launching on the phone?
Most often the problem is the absence required permissions in the manifest or an error in native plugins. Check the logs via Logcat in Android Studio or the built-in Unity console output when the device is connected. Also make sure that the processor architecture (ARMv7/ARM64) is selected correctly in the build settings.
What is the difference between APK and AAB?
APK is an installation package that contains resources for all device configurations, which makes it heavier. AAB (Android App Bundle) is a publishing format that Google Play uses to generate optimized APKs specifically for the user's device, saving space and traffic.
How to reduce the size of the final application file?
Use ASTC texture compression, enable code stripping (Remove Unused Code) in the player settings, remove unused assets from the folder Resources and check to see if the build includes entire scenes or libraries that are not needed for the current build.
Do you need to pay to publish to Google Play?
Yes, creating a Google Developer Account requires a one-time fee of $25. You can then publish an unlimited number of apps without paying a monthly fee, unlike some other platforms.