react native build release from .apk to .aab, how to send the app to the clients?
Asked Answered
J

8

23

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?

Jellaba answered 19/10, 2019 at 14:17 Comment(1)
Possible duplicate of Generate Apk file from aab file (android app bundle)Chace
V
33

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
Voidance answered 19/10, 2019 at 18:18 Comment(3)
Please edit your answer, as referred by Paul Freeman. its the correct command.Svetlanasvoboda
If you are on windows then omit the ./. It should be gradlew assembleRelease only.Execrate
The command from RN doc is ./gradlew bundleRelease (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/releaseCerise
F
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
Fullblown answered 1/11, 2020 at 11:3 Comment(0)
C
5

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.

Calaverite answered 6/5, 2020 at 12:21 Comment(0)
W
5
cd android
./gradlew bundleRelease
Wolfish answered 29/10, 2022 at 7:49 Comment(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.Hamill
F
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

Fontanez answered 4/4, 2022 at 7:0 Comment(0)
A
0

if you want to generate APK file instead of aab file using for Manual Testing then follow below steps.

 1. cd android
 2. ./gradlew clean
 3. ./gradlew assembleRelease

Thanks.

Acro answered 1/11, 2023 at 12:5 Comment(0)
D
0

in the newer version

first, go to the Android folder and run the below command

./gradlew clean

this will clean the project by removing the build directory and all the files generated during previous builds

Now run the below command to generate a production-level aab file

npx react-native build-android --mode=release

this will create an aab file in android/app/build/outputs/bundle/release/app-release.aab

Note:- if the build fails try to delete drawable-* files in android/app/src/main/res/ folder

Dimer answered 31/5, 2024 at 9:51 Comment(0)
C
0

If you're using React Native for app development, you can send a .apk and .aab file to the client.

To generate an apk file, follow the given steps:

  • Move to the Android folder as

cd android

  • Then run the following command to make the apk file:

./gradlew assembleRelease

After the execution of the above command, the APK file can be located at: your_project\android\app\build\outputs\apk\release

If you want to send the .aab file, follow the documentation from React Native, as it is a multiple-step procedure. Visit the docs here:

Generate .aab file in React Native

Condemn answered 5/8, 2024 at 19:46 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.