U
22 / 22 · 10 min
FAQ

From project to APK on a real phone

the short answer

How do I build an APK and get it onto an Android phone?

Install the Android Build Support module, switch the platform to Android, set a package name of your own, and build. What stops most first builds is an SDK or JDK path Unity cannot find; what bites later is shipping the default com.DefaultCompany package name, because a package name can never change once the app is on Google Play.

Getting an APK onto a phone is four steps and two traps. The steps take twenty minutes the first time; the traps are what turn that into an afternoon.

1 — Install Android Build Support

  1. 1

    Open Unity Hub, go to Installs, and use the gear menu on your Unity version to add modules.

  2. 2

    Tick Android Build Support, and both items nested underneath it: the SDK & NDK Tools and the OpenJDK. All three, not just the first.

  3. 3

    It downloads a few gigabytes. Let it finish before opening the project, or the platform list will still show Android as unavailable.

2 — Switch the platform

Switching platform re-imports every texture in the project into a format Android can read. On a small project it takes a minute; on a large one it is worth starting before you make coffee. It only happens once per platform.

  1. 1

    Open File▸Build Profiles (called Build Settings before Unity 6), pick Android, and press Switch Platform.

  2. 2

    Press Add Open Scenes with every scene you want in the build open. A scene that is not on this list does not exist in the built game.

  3. 3

    The scene at index 0 is the one the game starts on. Drag it to the top if it is not already there.

3 — Player Settings that actually matter

  • Package Name — change it. The default com.DefaultCompany.ProjectName installs fine for testing, but the package name is your app's permanent identity on Google Play: it can never be changed after the app is published.

  • Minimum API Level — 24 or higher covers effectively every phone in use and avoids a pile of compatibility work.

  • Scripting Backend IL2CPP and Target Architectures ARM64 — the Play Store has required 64-bit for years. Mono and ARMv7 alone will be refused at upload.

4 — Build and install

  1. 1

    On the phone, enable Developer options by tapping Build number seven times in Settings > About, then turn on USB debugging.

  2. 2

    Plug the phone in and accept the Allow USB debugging prompt on its screen. Without accepting it, Unity will not list the device.

  3. 3

    Press Build And Run. Save the .apk into a Builds folder next to Assets, never inside Assets — Unity would try to import your own build as an asset.

APK or AAB?

  • APK for testing: one file you can send to someone and they install it directly.

  • AAB for the Play Store, which requires it. Google builds the per-device APKs from it, so you cannot install an AAB yourself.

  • Tick Build App Bundle in Build Profiles to switch between them. Everything else stays the same.

When it installs but crashes on launch

The one command that tells you why
# Only your app's messages, from the moment you run it.
adb logcat -c && adb logcat Unity:V CRASH:V AndroidRuntime:E '*:S'

the lesson that builds this

Build, install, debug on device

This post is a standalone recipe. In the course, the same thing is built as part of the one project that runs through all five tabs — Export to Mobile, lesson 05.