Build an APK from Your Expo App - abhiram-shaji/Langroove GitHub Wiki
Welcome to this guide on building an APK (Android Package) from your Expo app. In this wiki, we'll go step by step on how to turn your Expo project into a standalone APK file. There are two main ways to achieve this:
- Using Expo's Classic Build Service (Deprecated)
- Using EAS Build (Expo Application Services)
We’ll focus on the more modern and recommended approach using EAS Build, but will include the classic method for reference.
1. Using EAS Build (Recommended)
Expo has introduced EAS Build, which provides a more flexible and powerful build service compared to the older expo build
system.
Step 1: Install EAS CLI
To get started with EAS, you need to install the EAS CLI globally on your machine.
npm install -g eas-cli
Step 2: Configure Expo App for EAS
Before building, make sure your Expo app is configured for EAS. You need to run the following command to set up an eas.json
file, which will contain your build configuration.
eas build:configure
This command will guide you through setting up your app for EAS builds. It will also generate the eas.json
configuration file in your project root. Here’s an example of what it could look like:
{
"build": {
"production": {
"android": {
"buildType": "app-bundle"
}
}
}
}
Step 3: Create a Keystore
You’ll need a keystore to sign your APK. You can let EAS generate one for you by following the prompts during the build process, or you can use your own. To manage the credentials, run:
eas credentials
Step 4: Build the APK
Run the following command to start building your APK:
eas build --platform android --profile production
You can monitor the progress on your terminal, and once completed, the APK will be available for download via a link provided by Expo.
Step 5: Download and Test the APK
Once the build is done, Expo will provide a link where you can download the APK. You can now test it on your device by manually installing the APK or sharing it with others for testing.
2. Using Expo’s Classic Build (Deprecated)
While this method is deprecated, it's still available. If you are not using EAS and want to use the old method:
Step 1: Ensure Classic Expo Workflow
Make sure you are using the classic Expo-managed workflow. If you are in a bare workflow, use EAS Build.
Step 2: Build the APK
To build an APK using Expo's classic build service, run:
expo build:android
Expo will guide you through the process, including setting up an Android keystore if you haven’t already.
Step 3: Choose APK or App Bundle
Expo will ask if you want to build an APK or an Android App Bundle (AAB). Choose APK if your goal is to get a standalone APK file:
? Would you like to build a development APK or a production AAB? (Use arrow keys)
❯ APK
Step 4: Wait for Build to Complete
After Expo finishes building the APK, it will provide a link to download the APK file. You can then install this APK on your Android device for testing.
Step 5: Test the APK
Download the APK file from the provided link and install it on your Android device by transferring it via USB or downloading it directly to your device.
Additional Notes
-
For EAS builds, ensure your
app.json
has the correct values under theexpo.android
section, such as the package name and permissions.Example:
{ "expo": { "android": { "package": "com.yourappname", "permissions": ["CAMERA", "LOCATION"] } } }
-
You can manage your keystore with EAS CLI by using the following command:
eas credentials
-
For continuous updates and documentation on EAS, refer to Expo Documentation.
By following this guide, you can easily turn your Expo app into a standalone APK, ready for distribution and testing on Android devices.