0
0
UnityHow-ToBeginner · 4 min read

How to Set Up Android Build in Unity: Step-by-Step Guide

To set up an Android build in Unity, first install the Android Build Support module via Unity Hub including SDK, NDK, and OpenJDK. Then, configure your project’s Build Settings by selecting Android as the platform and setting up the Player Settings with your app details before building the APK.
📐

Syntax

Unity does not use traditional code syntax for Android build setup but follows a sequence of configuration steps:

  • Install Android Build Support: Includes SDK, NDK, OpenJDK needed for Android builds.
  • Switch Platform: In File > Build Settings, select Android and click Switch Platform.
  • Player Settings: Configure app name, package identifier, version, and minimum API level.
  • Build: Click Build or Build and Run to generate the APK.
unity
No code syntax applies; setup is done via Unity Editor UI.
💻

Example

This example shows how to set up and build a simple Android APK in Unity:

  1. Open Unity Hub and create a new 3D project.
  2. Go to Unity Hub > Installs, click the three dots on your Unity version, select Add Modules, and install Android Build Support with SDK, NDK, and OpenJDK.
  3. Open your project, go to File > Build Settings, select Android, and click Switch Platform.
  4. Click Player Settings, under Other Settings set the Package Name to com.yourname.app and set the Minimum API Level to at least Android 7.0 (API level 24).
  5. Back in Build Settings, click Build, choose a folder, and save the APK.
unity
No code required; all steps are done in Unity Editor UI.
Output
An APK file is generated in the chosen folder, ready to install on Android devices.
⚠️

Common Pitfalls

Common mistakes when setting up Android builds in Unity include:

  • Not installing Android Build Support module, causing build errors.
  • Forgetting to switch the platform to Android before building.
  • Incorrect Package Name format (must be like com.company.app).
  • Using an API level too low for your target device.
  • Not enabling Development Build when debugging, which makes testing harder.

Always check Unity Console for errors and warnings after building.

text
// Wrong package name example:

// Incorrect
com.yourname

// Correct
com.yourname.app
📊

Quick Reference

StepActionDetails
1Install Android Build SupportUse Unity Hub to add SDK, NDK, OpenJDK modules
2Switch PlatformFile > Build Settings > Select Android > Switch Platform
3Set Player SettingsConfigure Package Name, Version, API Level
4Build APKClick Build or Build and Run to generate APK
5Test APKInstall on device or emulator to verify

Key Takeaways

Install Android Build Support module with SDK, NDK, and OpenJDK via Unity Hub before building.
Always switch the build platform to Android in Build Settings before building.
Set a valid package name in Player Settings using the format com.company.app.
Choose an appropriate minimum API level for your target Android devices.
Use Build and Run for quick testing on connected devices.