Reputation: 131
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?
Upvotes: 6
Views: 11990
Reputation: 409
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
to apk
developmentClient
to true
: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 application
you 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 )
{
"cli": {
"version": ">= 0.52.0"
},
"build": {
"preview": {
"android": {
"buildType": "apk"
}
},
"preview2": {
"android": {
"gradleCommand": ":app:assembleRelease"
}
},
"preview3": {
"developmentClient": true
},
"production": {}
}
}
--
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
bundletool build-apks --bundle=bundle.aab --output=app.apks --mode=universal
https://github.com/google/bundletool
Upvotes: 7
Reputation: 317
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
Upvotes: 3
Reputation: 4849
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
Upvotes: 3
Reputation: 463
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).
Upvotes: 1