By Loish, posted on Pinterest by kukricat
EAS (Expo Application Services)
build apps for Android and iOS using Expo Application Services (EAS). covers Build, Update, and Submit workflows.
Dev Build (dev env) : project version optimized for quick iterations. contains the expo-dev-client
lib
- install
expo-dev-client
lib
pnpx expo install expo-dev-client
- init a development build
- install EAS CLI system wide
npm i -g eas-cli
- auth into expo account
eas login
- init and link project to the EAS
eas init
Logs
eas login
Log in to EAS with email or username (exit and run eas login --help to see other login options)
✔ Email or username … syl_ves_ter
✔ Password … *********
Logged in
eas init
✔ Would you like to create a project for @syl_ves_ter/rn-beginner? … yes
✔ Created @syl_ves_ter/rn-beginner: https://expo.dev/accounts/syl_ves_ter/projects/rn-beginner
✔ Project successfully linked (ID: 2fd3f393-6567-43b8-a04e-84dc68a831f9) (modified app.json)
-
Configure project for EAS build
- setup
eas build:configure
logs
eas build:configure
💡 The following process will configure your iOS and/or Android project to be compatible with EAS Build. These changes only apply to your local project files and you can safely revert them at any time.
✔ Which platforms would you like to configure for EAS Build? › All
✔ Generated eas.json. Learn more: https://docs.expo.dev/build-reference/eas-json/
🎉 Your project is ready to build.
- Run eas build when you are ready to create your first build.
- Once the build is completed, run eas submit to upload the app to app stores.
- Learn more about other capabilities of EAS Build: https://docs.expo.dev/build/introduction
Android dev build
- andorid dev builds must be in
.apk
. - default format is
.aab
| ideal for G-Play store distcannot be installed on an emu or physical device
- create
.apk
eas.json
build {
development {
developmentClient:true
}
}
-
run
- platform android
- profile: development
eas build -p android --profile development
- logs
eas build -p android --profile development
Loaded "env" configuration for the "development" profile: no environment variables specified. Learn more: https://docs.expo.dev/build-reference/variables/
📝 Android application id Learn more: https://expo.fyi/android-package
✔ What would you like your Android application id to be? … com.syl_ves_ter.rnbeginner
No remote versions are configured for this project, versionCode will be initialized based on the value from the local project.
✔ Initialized versionCode with 1.
✔ Using remote Android credentials (Expo server)
✔ Generate a new Android Keystore? … yes
✔ Created keystore
Compressing project files and uploading to EAS Build. Learn more: https://expo.fyi/eas-build-archive
✔ Uploaded to EAS 4s
Build details: https://expo.dev/accounts/syl_ves_ter/projects/rn-beginner/builds/79a3ebd5-9a8c-4ec6-b55c-d3f9408fafbe
Waiting for build to complete. You can press Ctrl+C to exit.
✔ Build finished
✔ Install and run the Android build on an emulator? … yes
✔ Successfully downloaded app 6m 49s
✔ Select an emulator to run your app on › Pixel_8_API_27
Opening emulator Pixel_8_API_27
Waiting for the Android emulator to start...
Installing your app...
✔ Successfully installed your app!
Starting your app...
✔ Successfully started your app!
IOS dev build | !simulator !emulator device
- register device
eas device:create
ok not officially registered as an ios developer. will just focus on android for now and apply for ios dev later on. it's one dev platform afterall (expo! iz 😜 )
logs
eas device:create
This command lets you register your Apple devices (iPhones, iPads and Macs) for internal distribution of your app.
Internal distribution means that you won't need to upload your app archive to App Store / Testflight.
Your app archive (.ipa) will be installable on your equipment as long as you sign your application with an adhoc provisioning profile.
The provisioning profile needs to contain the UDIDs (unique identifiers) of your iPhones, iPads and Macs.
First of all, choose the Expo account under which you want to register your devices.
Later, authenticate with Apple and choose your desired Apple Team (if your Apple ID has access to multiple teams).
✔ You're inside the project directory. Would you like to use the syl_ves_ter account? … yes
› Log in to your Apple Developer account to continue
✔ Apple ID: … abanyseka98@gmail.com
› The password is only used to authenticate with Apple and never stored on EAS servers
Learn more: https://bit.ly/2VtGWhU
✔ Password (for my appleID): … *********************
› Saving Apple ID password to the local Keychain
Learn more: https://docs.expo.dev/distribution/security#keychain
✔ Logged in, verify your Apple account to continue
Two-factor Authentication (6 digit code) is enabled for abanyseka98@gmail.com. Learn more: https://support.apple.com/en-us/HT204915
✔ How do you want to validate your account? … device / sms
✔ Please enter the 6 digit code … ******
✔ Valid code
✔ Logged in and verified
Authentication with Apple Developer Portal failed!
Apple provided the following error info:
You are not registered as an Apple Developer. Please visit Apple Developer Registration. https://developer.apple.com/register/
Error: device:create command failed.
App variants
configure a project to run a build type in
- dev
- preview
- prod mod simultaneously on a device each of these requires a unique android appid or ios bundleid
- rename
app.json
toapp.config.js
for a dynamic config
app.config.js
const IS_DEV = process.env.APP_VARIANT === "development";
const IS_PREVIEW = process.env.APP_VARIANT === "preview";
const getUniqueIdentifier = () => {
if (IS_DEV) return "com.sylvester.rnbeginner.dev";
if (IS_PREVIEW) return "com.sylvester.rnbeginner.preview";
return "com.sylvester.rnbeginner";
};
const getAppName = () => {
if (IS_DEV) return "rn_beginner (Dev)";
if (IS_PREVIEW) return "rn_beginner (Preview)";
return "rn_beginner: Emoji Stickers";
};
export default {
expo: {
name: getAppName(),
slug: "rn-beginner",
version: "1.0.0",
orientation: "portrait",
icon: "./assets/images/icon.png",
scheme: "myapp",
userInterfaceStyle: "automatic",
splash: {
image: "./assets/images/splash.png",
resizeMode: "contain",
backgroundColor: "#25292e",
},
ios: {
supportsTablet: true,
bundleIdentifier: getUniqueIdentifier(),
},
android: {
package: getUniqueIdentifier(),
adaptiveIcon: {
foregroundImage: "./assets/images/adaptive-icon.png",
backgroundColor: "#ffffff",
},
},
web: {
bundler: "metro",
output: "static",
favicon: "./assets/images/favicon.png",
},
plugins: ["expo-router"],
experiments: {
typedRoutes: true,
},
extra: {
eas: {
projectId: "2fd3f393-6567-43b8-a04e-84dc68a831f9",
},
},
owner: "syl_ves_ter",
},
};
eas.json
add the env vars for each variant
{
"cli": {
"version": ">= 12.6.0",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
"env": {
"APP_VARIANT": "development"
}
},
"preview": {
"distribution": "internal"
"env": {
"APP_VARIANT": "preview"
}
},
"production": {
"autoIncrement": true
}
},
"submit": {
"production": {}
}
}
eas build --profile development
set's the mode to dev
🚨 ensure the application id follows the proper format. convert all
-
to_
, or use only lowercases . in my casecom.syl_ves_ter.rn-beginner
-com.syl_ves_ter.rn_beginner
| works only for android builds and fails for ioscom.syl_ves_ter.rn-beginner
-com.sylvester.rnbeginner
| works for all platforms
- still haven't registered for ios developer tho. so apple build will fail
logs
❯ eas build --profile development
✔ Select platform › All
Loaded "env" configuration for the "development" profile: APP_VARIANT. Learn more: https://docs.expo.dev/build-reference/variables/
No remote versions are configured for this project, versionCode will be initialized based on the value from the local project.
✔ Initialized versionCode with 1.
🤖 Android build
✔ Using remote Android credentials (Expo server)
✔ Generate a new Android Keystore? … yes
✔ Created keystore
Compressing project files and uploading to EAS Build. Learn more: https://expo.fyi/eas-build-archive
✔ Uploaded to EAS 7s
Loaded "env" configuration for the "development" profile: APP_VARIANT. Learn more: https://docs.expo.dev/build-reference/variables/
No remote versions are configured for this project, buildNumber will be initialized based on the value from the local project.
✔ Initialized buildNumber with 1.
🍏 iOS build
✔ Using remote iOS credentials (Expo server)
If you provide your Apple account credentials we will be able to generate all necessary build credentials and fully validate them.
This is optional, but without Apple account access you will need to provide all the missing values manually and we can only run minimal validation on them.
✔ Do you want to log in to your Apple account? … yes
› Log in to your Apple Developer account to continue
✔ Apple ID: … abanyseka98@gmail.com
› Restoring session /home/abanseka/.app-store/auth/abanyseka98@gmail.com/cookie
› Session expired Local session
› The password is only used to authenticate with Apple and never stored on EAS servers
Learn more: https://bit.ly/2VtGWhU
✔ Password (for my appleid): … *********************
› Saving Apple ID password to the local Keychain
Learn more: https://docs.expo.dev/distribution/security#keychain
✔ Logged in, verify your Apple account to continue
Two-factor Authentication (6 digit code) is enabled for abanyseka98@gmail.com. Learn more: https://support.apple.com/en-us/HT204915
✔ How do you want to validate your account? … device / sms
✔ Please enter the 6 digit code … ******
✔ Valid code
✔ Logged in and verified
Authentication with Apple Developer Portal failed!
Apple provided the following error info:
You are not registered as an Apple Developer. Please visit Apple Developer Registration. https://developer.apple.com/register/
Error: build command failed.
Internal distribution build
- share updates with team members
- allow technical and non-technical stakeholders to provide feedback
- don't need a dev server
ways to distribute an app internally
- android: google play beta
- ios: testFlight
these have limitations tho. testFlight limits to one active build at a time
EAS Build
- speeds up the process for faster distribution
- creates shareable links for a build with provided instructions on how to use
- configured to facilitate internal distribution,more efficient to the traditional android and ios methods
Create an internal distribution build
- configure preview build profile
eas build -p android --profile preview
triggers an internal distribution build on the expo dashboard
does not need app signing credentials
logs
Loaded "env" configuration for the "preview" profile: APP_VARIANT. Learn more: https://docs.expo.dev/build-reference/variables/
No remote versions are configured for this project, versionCode will be initialized based on the value from the local project.
✔ Initialized versionCode with 1.
✔ Using remote Android credentials (Expo server)
✔ Generate a new Android Keystore? … yes
✔ Created keystore
Compressing project files and uploading to EAS Build. Learn more: https://expo.fyi/eas-build-archive
✔ Uploaded to EAS 3s
Build details: https://expo.dev/accounts/syl_ves_ter/projects/rn-beginner/builds/79715d08-8c68-458c-8dfa-88d6054b8684
Waiting for build to complete. You can press Ctrl+C to exit.
✔ Build finished
Managing application versions
dev vs client facing app version
- dev (G-Play && App Store depencies)
versionCode
for androidbuildNumber
fro iOS
- client (user)
app.config.js
version
e.g whatsapp v1.0.0(1)
- has a combination of developer and user facing values
submitting builds with duplicate app version numbers result in a failed submission
although the versionCode
and buildNumber
can be added manually into the app.config.js
it could be
automated by using the EAS
build remote version resource, except the client(user) version
which get's defined in the app store
developer portals before a prod app is submmited for review
eas.json
{
"cli": {
"appVersionSource": "remote"
},
"build": {
"production": {
"autoIncrement": true
}
}
}