I’m a new learner on this platform.
I code a simple react native app using expo. But I want to build a .apk file.
I tried this command:
expo build:android
Then I sign up an expo account. After completing the building process it shows the download button.
Just like the following picture: But its not apk file. It is .aab file.
So, I want to build an actual apk file.
How can I do that?
4
Answers
From expo documentation :
When building for android you can choose to build APK (expo build:android -t apk) or Android App Bundle (expo build:android -t app-bundle).
By default Expo, CLI builds the app into a
.aab
file format. this format is better for Google Play Store as it will be optimized for every device CPU architecture which results in a smaller app size.In case you want to test for your device or emulator, run:
expo build:android -t apk
Update for new users:
Run the following:
›
npm install -g eas-cli
›
eas build -p android
https://docs.expo.dev/build/setup/expo build:android will be discontinued on January 4, 2023
to build a apk out of the file first you need to do some changes to your
eas.json
file.By default, EAS Build produces Android App Bundle, you can change it by:
buildType
toapk
developmentClient
totrue
:app:assembleRelease
,:app:assembleDebug
or any othergradle command that produces APKafter changing the config you can run
eas build -p android --profile preview
to build the applicationyou can read more about this in docs
https://docs.expo.dev/build-reference/apk/
and here’s a sample config i used for a basic project to build ( also you can find on docs )
—
also alternatively another possible way would be to get the bundle ( .aab ) file and convert it to apk using a too like bundletool. and you can find the apk ( universal.apk ) inside app.apks
https://github.com/google/bundletool