Skip to content
Back to skills

Unity Android Release

ASecurity

Build a signed Android APK or AAB for Play: keystore, versionCode, SDK levels, permissions, icons.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 12, 2026
ai-agentsrustgoshellbashtestingdebugginggitapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 11 files and shows the line behind each finding

Scanned November 12, 2026

npx -y skills add tipoLi5890/unity-dev-skills --skill unity-android-release --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unity Android Release?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unity Android Release
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tipoli5890-unity-android-release/badge)](https://www.skillsdirectory.com/skills/tipoli5890-unity-android-release)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unity-android-release
description: >-
  Build a signed Android APK or AAB for Play: keystore, versionCode, SDK
  levels, permissions, icons.
---

# unity-android-release — build it, then prove it

Two claims are worth nothing on their own, and this skill exists to replace both with evidence:

> **"It built."** Says compilation and packaging finished. Not whether it is signed, not with what,
> not which permissions it declares, not whether it contains code for the CPU you ship to.
>
> **"I changed that setting."** Says a file on disk differs. Not that the file is the one the
> project actually loads — a dormant asset takes every change silently
> (`reference/device-triage.md`).

## Request → where to look

| The request | Go to |
|---|---|
| "build an APK", "make an AAB for Play" | *Ready-made templates*, `reference/store-submission.md` |
| "set up the build script" | `reference/build-automation.md` |
| "keystore", "versionCode", package name | `reference/signing-and-versioning.md` |
| "which permissions does my app actually declare", ABIs, is it signed | `reference/artifact-verification.md` |
| "which minSdk/targetSdk can I set", "16 KB page size", "adaptive launcher icon" | `reference/player-settings-android.md` |
| "works in the editor but the phone shows garbage / crashes on launch / renders wrong" | `reference/device-triage.md` |
| A native plugin's permissions or libraries | *Native plugins* below |

---

## Settings that are expensive to change later

Get these right before the **first** artifact leaves your machine.

- **IL2CPP + ARM64.** Play requires 64-bit; Mono and ARMv7 are dead ends. Strip Engine Code on;
  managed stripping starts Low until reflection users are annotated in `link.xml`, because
  over-stripping only shows up in the built player.
- **Package name is store identity and is locked once published.** Unity's template default
  (`com.DefaultCompany.<Project>`) reaching a store is unrecoverable. Set it on every platform.
- **`versionCode` is monotonic per artifact handed to anyone**, not just per store upload.
- **Keystore before the first release build**, backed up outside the repo, password with it.
- **`minSdk` has a floor and `targetSdk` has a store minimum, and neither is your preference.**
  Unity clamps `minSdkVersion` up to its own floor (25 on 6000.4, 26 from 6000.5), so a plan
  promising "Android 6 / API 23" is already wrong. Play requires a recent `targetSdk` (the current
  level is in the repo's `VERSIONS.md`), and from Android 15 a `targetSdk` 35+ app cannot load a
  `.so` aligned to 4 KB pages on a 16 KB-page device. So a 4 KB-aligned library is a **blocker to
  rebuild or replace**, not a ceiling to pin under: pinning `targetSdk` 34 is for sideloaded builds
  outside Play only. Check the alignment **before** promising a store date —
  `reference/player-settings-android.md`.
- **Secrets arrive on stdin, never in `argv`.** A password expanded from an environment variable
  is still visible in the process list; CI must mask it in logs as well. `Tools/.build-env` stays
  gitignored and is read, not passed.

## Ready-made templates

`templates/` holds the working versions, project-agnostic — they discover the project, the Unity
version, the SDK and the plugins instead of hardcoding any of it:

| File | Where it goes |
|---|---|
| `templates/BuildScript.cs` | `Assets/Scripts/Editor/` |
| `templates/build-android.sh` | `Tools/` (or anywhere inside the project) |
| `templates/build-env.example` | copy to `.build-env` beside the script, gitignore it |

```bash
Tools/build-android.sh doctor       # resolve what is ACTUALLY in effect; builds nothing
Tools/build-android.sh preflight    # doctor + release gates; exit 1 if unshippable → a CI gate
Tools/build-android.sh test         # debug-signed APK for sideloading
Tools/build-android.sh release --apk --install
```

**Run `doctor` first, every time you are about to change a setting and draw a conclusion from it.**
It prints the render-pipeline asset the project genuinely loads (from `GraphicsSettings`), the
pinned graphics APIs, and every native `.aar`'s ABI and 16 KB page alignment, `file:` UPM
dependencies included — what each check does and why: `reference/build-automation.md`.

## The CLI can sign an Android build itself — when that is enough

`unity build` takes `--android-export-type apk|aab|android-studio-project`,
`--android-keystore-base64`, `--android-keystore-password`, `--android-key-alias`,
`--android-key-alias-password`, `--android-target-sdk-version`, `--android-version-code` and
`--android-symbol-type none|public|debugging` (check `unity build --help` on your CLI version). So
a one-line signed build is possible with no BuildScript at all.

| Use the CLI flags when | Use the committed script when |
|---|---|
| A throwaway or exploratory build | Anything anyone else will install |
| You are checking whether signing works at all | You need the gates: template package name, reused `versionCode`, missing ABI |
| Nothing depends on the result being reproducible | You want the artifact read back and a provenance record written |

Two things the flags do not change:

- **Secrets in `argv` are visible** — the CLI's own help says so. Read them from a gitignored
  env file; never expand them onto a command line, and mask them in CI logs.
- **`unity build` refuses a dirty tree by default** (there is an `--allow-dirty-build` to
  override it). Leave the default alone. A build from an uncommitted tree is not reproducible,
  and that is exactly the build someone will later ask you to reproduce.

## Load what the situation needs

| The situation | Read |
|---|---|
| Setting up a repeatable build; writing the script; shell traps that bite | `reference/build-automation.md` |
| `minSdk`/`targetSdk`, the 16 KB page-size rule, launcher icons from code; a 3D game's baseline, quality tiers, skin weights per tier | `reference/player-settings-android.md` |
| An artifact exists — is it signed, what does it declare, what ABIs? | `reference/artifact-verification.md` |
| Keystore, credentials, versionCode, build history, package name | `reference/signing-and-versioning.md` |
| **Works in the editor, wrong on the device** | `reference/device-triage.md` |
| Runs fine in the editor and badly on the device | skill `unity-device-testing`; the frame-time window in the player build is `unity-profiling` |
| APK vs AAB, symbols, Data Safety, the new-app testing gate | `reference/store-submission.md` |
| The artifact is too large; "works in the editor, missing on device" after stripping | `reference/size-and-stripping.md` |
| Shipping to the web instead of Android | skill `unity-web-release` |
| Runtime behaviour in the editor; screenshots; temporal faults | skill `unity-debug` |

## Native plugins: trust the merged output, not your settings

A UPM package's `.aar` merges its manifest, permissions and native libs at build time. When a
permission "isn't there" or appears unexpectedly, read the **merged** result out of the artifact —
never your own manifest.

The failure that passes every editor test and then kills the app on launch is an **ABI mismatch**:
the `.aar` has no `arm64-v8a` while you build ARM64-only. Check it before building, not after
installing — and make sure the check actually looked somewhere, because a `file:` UPM dependency
lives outside the project and a naive scan finds nothing and passes.

The same `.aar` also decides whether you can ship to Play at all. Its `.so` files being aligned to
4 KB pages (`llvm-readelf -l …| awk '$1=="LOAD"{print $NF}'` → `0x1000` rather than `0x4000`)
means a `targetSdk` 35+ build fails to load them on 16 KB-page devices — a crash that appears only
on some hardware — and Play no longer accepts a lower target. Get the library rebuilt at 16 KB or
replace it: `reference/player-settings-android.md`.

When a plugin needs custom Gradle (minSdk, dependencies), prefer a **Custom Main Gradle Template**
over hand-editing the export — exports are regenerated, templates persist.

## Discipline

- **Delete the expected artifact before building.** Unity exits 0 when it never started; a stale
  file then reads as success. Branch on the artifact existing, never on the exit code.
- **Refuse, do not warn**, for anything unrecoverable: template package name on a release, missing
  keystore, re-used `versionCode`, missing ABI. A warning in a build log is read by nobody.
- **Install it and play it.** IL2CPP stripping faults and shader-variant gaps are invisible until
  launch.
- **Quote the artifact's size from the file, never from the build report.** The report counts
  symbols and intermediates, so `BuildReport.summary.totalSize` can say 844 MB for a 69 MB APK.
  `du -h` is the download size (`reference/artifact-verification.md`).
- **Bisect one variable per round trip**, and say what each outcome would prove. A build plus an
  install plus someone playing it is expensive; reproduce in the editor first where you can.

## Scope — what this skill does NOT do

| Not here | Go to |
|---|---|
| WebGL / WebGPU artifacts | `unity-web-release` |
| The `unity` CLI's own surface, licences, CI wiring | `unity-cli` |
| Why the game misbehaves in the editor too | `unity-debug` |
| Store listing copy, pricing, screenshots | Not a build problem |
| IAP and ad SDKs, and what they add to the manifest | `unity-live-services` → `reference/monetization.md` |
| Driving the installed build on the phone: asserting on its log, tapping system dialogs, physical steps with a human | `unity-device-testing` |
| The same project on an iPhone or iPad | `unity-ios-build` |
| Day-one decisions · the UI that survives the device's real viewing conditions | `unity-new-project` · `unity-game-ui` |

Files in this skill

  • SKILL.md9.5 KB
  • reference/artifact-verification.md5.6 KB
  • reference/build-automation.md12.9 KB
  • reference/device-triage.md6 KB
  • reference/player-settings-android.md10 KB
  • reference/signing-and-versioning.md7.1 KB
  • reference/size-and-stripping.md4.2 KB
  • reference/store-submission.md3.9 KB
  • templates/BuildScript.cs7.6 KB
  • templates/build-android.sh23.4 KB
  • templates/build-env.example1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.