Reading time: 2 minutes
Today I’m going to show you how to generate an APK using eas in Expo React Native.
The first thing we’re going to do is install eas-cli:
npm install -g eas-cli
Once installed, we launch the command to configure:
eas build:configure
And this appears:
We select what we want to configure (iOS, Android, or both).
In my case, I select both.
Once configured, the default configuration looks like this:
{ "cli": { "version": ">= 0.42.4" }, "build": { "development": { "distribution": "internal", "android": { "gradleCommand": ":app:assembleDebug" }, "ios": { "buildConfiguration": "Debug" } }, "preview": { "distribution": "internal" }, "production": {} }, "submit": { "production": {} } }
Before executing anything, we need to have a free Expo account.
To log in with the account, we enter this:
npx expo login -h
We enter the email and password and we are logged in to Expo.
Now, to generate the APK, we need to enter the following command:
eas build -p android --profile preview
It will ask us to generate a new keystore:
Generate a new Android Keystore?
We choose yes, and we will use it for production.
Now we have to wait while the build is generated. Eas generates builds remotely on its own server, which allows us to generate Android / iOS without having the environment.
Once generated, the link where we can download our APK will appear. Remember that this APK is for development and not for production.