Publish to the app stores
To get your app to users, you join each store's developer program, set up signing, build signed app files and upload them. ng build --platform makes the signed files. Uploading and the store listings are manual for now.
Before you start, build and try the unsigned apps, as in Run on iOS and Android.
What signing is
Signing attaches a cryptographic signature to your app file that proves it came from you and hasn't been changed. The stores require it so that only you can publish updates to your app.
Join the developer programs
Each store needs a developer account, and both charge for it. At the time of writing:
- Apple Developer Program: US$99 a year. Enroll on developer.apple.com.
- Google Play Console: a one-time US$25 registration fee. Create a developer account.
A personal Google Play account created after November 13, 2023 must run a closed test first: at least 12 testers, opted in for at least 14 days, before the app can go to production. See Google's testing requirements.
Set up signing
Signing secrets never go in angular.json. The signing options name the environment variables that hold the secrets, and the build reads them. Add the options next to the app identity:
The variable names are yours to choose. If signing is only partly set up, for example a variable isn't set, the build stops and names what's missing.
iOS: App Store Connect API key
iOS signing uses an App Store Connect API key, which lets the build sign on your behalf. Xcode's tools then create the certificate and provisioning profile Apple needs by themselves, so you never open Xcode.
- Turn on API access. The account holder opens App Store Connect, goes to Users and Access → Integrations, and clicks Request Access.
- Generate a team key. In Users and Access → Integrations → App Store Connect API → Team Keys, click Generate API Key. Name it, choose the Admin role, and click Generate. Only an Admin can create team keys.
- Download the private key, a
.p8file. You can download it only once, and Apple keeps no copy, so store it safely. - Note the key ID and the issuer ID shown with your team keys, and your team ID from your Apple Developer account. Put the team ID in
ios.teamId. - Set the variables before you build:
Without iOS signing, the build makes only the simulator app. ios.teamId on its own signs only the builds --run installs on your iPhone, with the Apple ID signed in to Xcode. Apple's API key guide has the details.
iOS signing hasn't been verified against a real App Store Connect account yet. Use a key with the Admin role, which may be needed to create a distribution certificate. If signing fails, please open an issue.
iOS: ad hoc .ipa
To give the app to testers who don't have a Mac, export the .ipa with Apple's ad hoc method, which Xcode calls release-testing:
- It installs only on the iPhones registered to your team, in your Apple Developer account under Devices. Add each tester's iPhone there by its UDID, then build again, so the provisioning profile lists it. A phone you've run the app on with
--runis registered already. - It needs the paid Apple Developer Program. A free Apple ID's Personal Team can't export an
.ipa. - Testers install it by dragging it onto their iPhone in a Mac's Finder, or with Apple Configurator. Without a Mac, you send it through a service that installs ad hoc builds.
- Signing: with
ios.signingset, the API key signs, as for the App Store. Without it, the Apple ID signed in to Xcode does.
app-store-connect is the default export once ios.signing is set.
Android: upload keystore
Android signing uses an upload key, kept in a keystore file. Google Play checks that each upload is signed with it, then signs the app for users with its own key.
Create the keystore once with keytool, which comes with the JDK. This is the command from Android's docs:
- It asks for a password and for your name and organization. Recent JDKs use that one password for both the keystore and the key, so set both password variables to it.
- It writes
my-release-key.jks, holding one key that's valid for 10,000 days. my-aliasis the key's name. Put the same value inandroid.signing.keyAlias, which takes the alias itself, not a variable.- Keep the file safe, and out of git. Back it up with its passwords. If you lose it, you have to request an upload key reset in the Play Console.
Then set the variables before you build:
Without Android signing, the build signs the app with a debug key. That app installs on emulators and phones, but Google Play rejects it.
Build the signed apps
With signing set up, the build adds dist/ios/MyApp.ipa (for App Store Connect, or ad hoc with "export": "release-testing") and signs dist/android/my-app.aab with your upload key.
In CI, store the key files and passwords as the CI service's secrets, and expose them as the same environment variables.
Upload to the stores
ng build doesn't upload for you yet.
App Store:
- In App Store Connect, create an app with the same bundle ID as your
appId. - Upload
MyApp.ipa, e.g. with Apple's Transporter app for Mac. - Install it on your iPhone through TestFlight, Apple's app for testing builds. Then submit it for review.
Google Play:
- In the Play Console, create your app.
- Upload
my-app.aabto a release. Start on the internal testing track. New apps must be uploaded as.aabfiles. - When testing is done, promote the release to production.
Before you ship
- App ID: you've replaced
ng add'scom.example.*placeholder. The stores don't let you change it later. - Build number: it's higher than in your last upload.
- The built app works: install
MyApp-simulator.appormy-app.apkand try it. That's what your users get, not Lynx Explorer. - Icon: both apps use your
icon. Check the Android one on a phone or emulator: its launcher masks it to its own shape. Google Play's listing also wants a 512×512 icon, which you upload in the Play Console. - No debug aids: remove on-screen debugging, such as an error display.
- Crash reports:
LynxLoggeronly works with your dev server, so it's silent in shipped apps. AngularLynx can't upload error reports yet either (see Add your own handling), so plan how you'll hear about your users' errors. - Privacy manifest: the iOS build writes the app's
PrivacyInfo.xcprivacy, with Apple's reasons for the required-reason APIs that AngularLynx's own native code calls, for the features the app turns on. App Store Connect refuses an upload without them (ITMS-91053). It doesn't cover native plugins: a plugin whose code calls a required-reason API needs its reason in the app's manifest. Nor does it declare tracking or collected data. For any of these, eject the iOS project and add toios/App/PrivacyInfo.xcprivacyonly what applies: a plugin's reasons, if a plugin calls a required-reason API;NSPrivacyTrackingwithNSPrivacyTrackingDomains, if your app tracks (seeLynxTracking); and anNSPrivacyCollectedDataTypesentry for each type of data, if it collects data. Describe what your app collects in App Store Connect's App Privacy section as well. A project ejected before the build wrote the manifest has none: add it yourself. - Bundle size: budgets fail the build when the bundle grows past a limit.
- Android crash reports: the Android release build is shrunk with R8, which renames the app's Java and Kotlin classes. Google Play reads the mapping file that turns them back from the
.aab, so its crash reports show the real names.
Related
- Run on iOS and Android: build options and the app identity.
@blotch/angular-lynx-buildAPI: every signing option.- Embed in an existing native app: ship inside an app you already publish.
