I used the official documentation of React Native to build apk file. All other procedures worked fine but creating aab file is not working for me. I used the following command cd android && ./gradlew bundleRelease But it's not working on Windows. It is just giving me error of ". is not recognized"
Generating an AAB in Android Studio To create an AAB binary locally using Android Studio, open the Build menu, then choose “Generate Signed Bundle / APK.” Follow the prompts to sign the AAB with your keystore file. For complete details, view the Android documentation.
Bundling. Most React apps will have their files “bundled” using tools like Webpack, Rollup or Browserify. Bundling is the process of following imported files and merging them into a single file: a “bundle”. This bundle can then be included on a webpage to load an entire app at once.
Select APK to generate release APK for your React Native Android project. Then, Click on Next Select passwords for the keystore and key and rnter the certificate information. Thus, click on OK, then click on Next.
I’ve spent some time recently incorporating React Native components into our existing app. This comes with the extra requirement of release builds requiring the creation of the bundle file. I would have expected this to be a straightforward, well documented workflow, but was unfortunately a bit disappointed.
Step 1: Go to the root of the project in the terminal and run the below command: react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res Step 1. Generate a keystore
If everything compiles as expected you are good to go. Step 1. Generate a keystore You will need a Java generated signing key which is a keystore file used to generate a React Native executable binary for Android. You can create one using the keytool in the terminal with the following command
to create main js Bundle
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
and then run cd android && ./gradlew assembleRelease
cd android/
./gradlew bundleRelease
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With