21

It's been so long since I develop a mobile app in react native, when I'm developing before, I usually generate a release apk and send it to my clients so that they can test it and have experienced it, but now when I build a release in react native, it returns a .aab instead of .apk, how can I send my application to the clients when I only get .aab format on my project?

Dylan
  • 1,121
  • 1
  • 13
  • 28
  • Possible duplicate of [Generate Apk file from aab file (android app bundle)](https://stackoverflow.com/questions/53040047/generate-apk-file-from-aab-file-android-app-bundle) – sebastianf182 Oct 19 '19 at 18:13

5 Answers5

28

It using for different android devices installation by google play store. that's why you can use apk build for manual installation.

You must use the below command for the testing build.

$ cd android
$ ./gradlew assembleRelease
MBS
  • 673
  • 2
  • 16
  • 48
  • Please edit your answer, as referred by Paul Freeman. its the correct command. – Kash Mar 31 '20 at 16:16
  • 1
    If you are on windows then omit the `./`. It should be `gradlew assembleRelease` only. – Rubek Joshi May 10 '20 at 17:20
  • 1
    The command from RN doc is `./gradlew bundleRelease` (https://reactnative.dev/docs/signed-apk-android). Why and how is it different from `./gradlew assembleRelease` ? I noticed 1 thing when trying to create universal apk files: only `assembleRelease` allowed me to generate .apk file(s) directly, whereas `bundleRelease` didn't create anything in /android/app/build/outputs/apk/release – Morris Sep 19 '21 at 19:48
7

As mentioned repeatedly in many places .aab file is efficient. But we need .apk for regular task (except PlayStore).

So:-

  1. Create signed output of Android project Link
  2. Use command $ npx react-native run-android for debugging.
  3. Finally $ npx react-native run-android --variant=release Link, to create release version, which is created at android/app/build/outputs/bundle/release/app.apk
  4. Go crazy
Shanu ji
  • 359
  • 4
  • 5
4

Just for the information. If you upload the AAB to Google Play instead of the APK, it will lead to smaller download sizes. AAB lets Google Play create different APKs to different devices, based on the device screen density, language, and CPU architecture. So, if you're able to create AAB's, use them over APK's.

Roc Boronat
  • 11,395
  • 5
  • 47
  • 59
3
cd android
./gradlew bundleRelease
Pascal Nitcheu
  • 667
  • 7
  • 8
  • 1
    While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. – nima Oct 30 '22 at 07:34
0

The generated AAB can be found under

android/app/build/outputs/bundle/release/app-release.aab

, and is ready to be uploaded to Google Play