- Install the Expo CLI and EAS CLI: Make sure you have the Expo CLI and EAS CLI installed. You can install them using npm:bashCopy code
npm install -g expo-cli eas-cli
- Initialize EAS: If you haven’t initialized EAS for your Expo project yet, you can do so by running:bashCopy code
eas init
Follow the prompts to set up EAS for your project. - Configure the Build: Open your
app.json
file and make sure you have the appropriate configurations for the Android build. Ensure that theandroid
field is configured correctly with the necessary settings.Exampleapp.json
snippet:jsonCopy code{ "expo": { "android": { "package": "com.example.myapp", "versionCode": 1 } } }
- Build the AAB: Run the following command to start the build process:bashCopy code
eas build -p android
This command will build your project for Android, and if successful, it will generate an AAB file. - Retrieve the Build Artifacts: Once the build is complete, EAS will provide you with a link to download the build artifacts. You can also find the link in the EAS Build dashboard.Example output:bashCopy code
Build successfully started, it may take a few minutes to complete. You can monitor the build at https://expo.dev/accounts/your-account/builds/your-build-id
Open the provided link in your web browser, and you should be able to download the generated AAB file from there.
That’s it! You have successfully generated an Android App Bundle (AAB) using eas build
.
Now to convert an Android App Bundle (AAB) file to an APK file, you can use the bundletool provided by Google. The bundletool is a command-line tool that allows you to build APK sets from Android App Bundles. Here are the steps:
Prerequisites:
- Install Java: Ensure that you have Java installed on your machine. You can download and install OpenJDK or Oracle JDK.
- Download bundletool: You can download the bundletool JAR file from the official GitHub releases page: bundletool releases
Steps to Convert .AAB to .APK:
- Place AAB file and bundletool JAR in the Same Directory: Copy the AAB file you want to convert and the downloaded bundletool JAR file into the same directory.
- Open Terminal: Open your terminal or command prompt.
- Navigate to the Directory: Use the
cd
command to navigate to the directory where your AAB file and bundletool JAR are located.bashCopy codecd /path/to/directory
- Run bundletool to Generate APK Set: Use the following command to generate APK Set from the AAB file:bashCopy code
java -jar bundletool-all-<version>.jar build-apks --bundle=your-app.aab --output=your-app.apks
Make sure to replace<version>
with the version of the bundletool JAR file you downloaded, and replaceyour-app.aab
with the actual name of your AAB file. - Extract APKs from APK Set: Once the APK Set (
your-app.apks
) is generated, use the following command to extract the APKs:bashCopy codejava -jar bundletool-all-<version>.jar extract-apks --apks=your-app.apks --output-dir=output-directory
Replace<version>
with the version of the bundletool JAR file, and specify the output directory where you want to store the extracted APKs. - Find the APKs: The extracted APKs will be available in the specified output directory. Look for files with the
.apk
extension.
Now you have successfully converted the AAB file to APK files using the bundletool. Note that this process creates multiple APKs optimized for different device configurations. You can choose the appropriate APK based on your requirements.
Leave A Comment