Build Variants & Code Signing
Understand debug vs release builds, environments and flavors, and how Android keystores and Apple certificates and provisioning profiles prove who built an app.
Intermediate · about 5 hours · difficulty 3/5
Learn first: The Expo Workflow: Dev Builds, Config & Environments, Git & Version Control for App Projects
Before an app reaches a store it must be built in release mode and signed. Signing is how Android and iOS know an update really comes from you, and losing or mishandling keys is one of the most painful mistakes in mobile.
Build types and environments
- Debug builds include dev tools and connect to a dev server; release builds are optimised, minified and what users get.
- Most teams need environments (development, staging, production) with different API URLs, app names and icons so they can be installed side by side. Use Android product flavors, Xcode schemes and configurations, Flutter
--flavorand--dart-define, or Expoapp.config.tsreading an environment variable. - Bump versionName/versionCode (Android) and CFBundleShortVersionString/CFBundleVersion (iOS) for each upload; build numbers must always increase.
Android signing
You sign with a private key in a keystore. With Play App Signing, Google keeps the app signing key and you upload builds with a separate upload key that can be reset if lost. Never commit keystores or passwords to Git.
iOS signing
Apple requires a paid developer account. The pieces are:
- a certificate (development or distribution) tied to a private key,
- an App ID (bundle identifier) with capabilities like push,
- a provisioning profile linking certificate, app id and (for development) devices.
Xcode's automatic signing handles this for solo developers. Teams use EAS credentials or Fastlane match to share them safely.
Managed option
EAS Build can generate and store keystores, certificates and profiles for you, then build in the cloud with eas build --platform all --profile production.
Good enough to move on: you can produce a signed release build for each platform, install staging and production side by side, and explain where your signing keys are stored.
Key concepts
- Debug vs release builds
- Environments, flavors and schemes
- Version names and build numbers
- Android keystores and Play App Signing
- Apple certificates and provisioning profiles
- EAS Build and credentials: React Native
- Fastlane match
Mini project
Set up staging and production variants of an app with different names, icons and API URLs, and produce a signed release build of each for Android and iOS.
Check yourself
What happens if you lose your Android signing key without Play App Signing, and how does Play App Signing change that?
Free resources
- Expo: EAS Build (Expo)
- Android: Sign your app (Android Developers)
- Apple: Code signing (Apple)