Build, install, debug on device
Assets/
Scripts/
Settings/
Builds/
Project settings
you already havethis lesson adds
Everything is configured and the Knight can save its progress. Now press the button, get the file onto a phone, and learn to read the logs when it misbehaves.
Scenes and assets go in, an installable package comes out.
Build and Run
- 1
. Tick Development Build while you are still testing.
- 2
With the phone plugged in, press Build And Run. Unity builds, installs and launches in one step.
- 3
Save the output as Builds/game-dev.apk. Never inside Assets/ — Unity would try to import your own build.
- 4
First build: 10–20 minutes. Later builds with the same settings: 1–3 minutes.
Signing — the part everyone forgets
A debug build is signed with a temporary key. A release build needs your own keystore, and without it you cannot sign an update. Google Play can reset a lost upload key, but only through a support request that takes days — most other stores cannot help at all.
- 1
.
- 2
Save it OUTSIDE the project folder and back it up in two places. Treat this file as irreplaceable.
- 3
Never commit the .keystore or its passwords to git. Put *.keystore in .gitignore right now.
- 4
For the store: untick Development Build, tick Build App Bundle (Google Play), then Build.
Installing manually with adb
# install, replacing an existing copy
adb install -r Builds/game-dev.apk
# uninstall when the signature changed
adb uninstall com.yourstudio.yourgame
# launch it without touching the phone
adb shell monkey -p com.yourstudio.yourgame 1
# copy a build to the phone's Downloads folder
adb push Builds/game-dev.apk /sdcard/Download/Reading the device log
When the game crashes on the phone but works in the editor, logcat is the only thing that will tell you why.
# only Unity's messages — this is the one you want
adb logcat -s Unity
# clear the old log first so you only see this run
adb logcat -c && adb logcat -s Unity
# save it to a file to read carefully
adb logcat -s Unity > crash.txtEvery Debug.Log you wrote appears here, on the real device, in real time.
Look for lines starting with NullReferenceException — the stack trace below it names the exact script and line.
A crash with no Unity message at all is usually native: out of memory, or a missing ARM64 library.
An on-screen log for testers without a cable
using System.Collections.Generic;
using UnityEngine;
public class ScreenLogger : MonoBehaviour
{
private readonly List<string> lines = new List<string>();
[SerializeField] private int maxLines = 14;
void OnEnable() => Application.logMessageReceived += Handle;
void OnDisable() => Application.logMessageReceived -= Handle;
void Handle(string message, string stack, LogType type)
{
lines.Add($"[{type}] {message}");
if (lines.Count > maxLines) lines.RemoveAt(0);
}
void OnGUI()
{
GUI.skin.label.fontSize = 26;
GUI.Label(new Rect(20, 20, Screen.width - 40, Screen.height - 40),
string.Join("\n", lines));
}
}Before you upload to the store
Untick Development Build — a dev build is slower and cannot be published.
Test on at least one low-end device. The reviews you get are written on cheap phones.
Check the app on a phone with a notch and on a tablet — that is where UI anchoring bugs show up.
Play Console requires: an AAB, a target API level no more than a year old, a privacy policy URL, and a 512×512 icon.