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"
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
Below command work perfectly in mac
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && cd ./android && ./gradlew app:assembleRelease
On Windows, you can use the gradlew executable made for Bash , unless you install WSL for Windows (which is highly recommended for many other reasons, so then your./gradlew would just work in the WSL shell). Without WSL, you need to use the gradlew.bat
file instead, which should be in your android folder in your repo as its included in the react native starter files.
From then on, every command you see written with ./gradlew
should be replaced with it, eg gradlew.bat assembleRelease
. Be sure to be in the 'android' folder though.
cd android/
./gradlew bundleRelease
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.