Setting Up EAS CLI
EAS CLI is a command-line tool that allows you to interact with EAS services directly from your terminal. To install it, execute the following command:
npm install -g eas-cli
This command also allows you to check if a new version of EAS CLI is available. We strongly recommend keeping your EAS CLI up-to-date.
While npm is our recommended choice for global package installations, you can also use npx eas-cli@latest. Just remember to replace eas with npx eas-cli@latest in the documentation.
Logging In to Your Expo Account
If you’re already logged into an Expo account using Expo CLI, you can skip this step. If not, log in by running:
eas login
You can verify your login status by running eas whoami.
Configuring Your Project
To set up an Android or iOS project for EAS Build, execute:
eas build:configure
Running a Build
Building for Android Emulator/Device or iOS Simulator
The quickest way to test EAS Build is to create a build that you can run on your Android device/emulator or iOS Simulator. This method is faster than uploading it to a store and doesn’t require store developer membership accounts. If you’d like to try this, read about creating an installable APK for Android and creating a simulator build for iOS.
Building for App Stores
Before you can start the build process for app stores, you’ll need a store developer account and app signing credentials. Whether you’re experienced with generating app signing credentials or not, EAS CLI simplifies the process. You can opt for EAS CLI to handle the app signing credentials process. For more information, check out the steps for Android app signing credentials or iOS app signing credentials process.
To build for Android, iOS, or both, use the following commands respectively:
eas build --platform android
eas build --platform ios
eas build --platform all
Building APKs for Android Emulators and Devices
To generate an .apk, you’ll need to modify the eas.json by adding one of the following properties in a build profile:
- developmentClient set to true (default)
- distribution set to internal
- android.buildType set to apk
- android.gradleCommand set to :app:assembleRelease, :app:assembleDebug or any other gradle command that produces .apk
Here’s an example of how your eas.json file might look:
{
"build": {
"preview": {
"android": {
"buildType": "apk"
}
},
"preview2": {
"android": {
"gradleCommand": ":app:assembleRelease"
}
},
"preview3": {
"developmentClient": true
},
"preview4": {
"distribution": "internal"
},
"production": {}
}
}
Now, you can run your build with the following command:
eas build -p android --profile preview
Remember, you can name the profile whatever you like. In this example, we named the profile preview. However, you can name it local, emulator, or whatever makes the most sense for you.
I hope this helps! Let me know if you have any other questions. comment below 😊
Comments
Post a Comment
Share with your friends :)
Thank you for your valuable comment