React Native
has gained popularity over the years, with the whole concept of cross-platform development developer has flocked to it. l am one of the developers. l started React Native about 2 years ago and l did a bit of CLI before loving Expo
Debate is still on about what is better CLI or Expo.
After a while not using CLI, l ended up wanting to use it for some project. l settled my Android environment and everything but everytime l wanted to generate a stand alone debug apk using gradlew assembleDebug
it would build an apk that still required the Metro server. l mean how absurd. l tried building it in Android Studio and same issue came up.
l discovered that they now commented some build features in /android/app/build.gradle
file. They are now optional and everytime you want a standalone apk you need to uncomment some few lines.
For example these lines preceeding the hemes engine use in build:
bundleInDebug: true,
bundleAssetName: "index.android.bundle
So l thought of sharing this, if anyone ever get confused to as what's happening. Thank you for reading!
Top comments (1)
To generate an APK in React Native CLI, first ensure your environment is set up by installing Node, Watchman, the React Native CLI, and Android Studio. In Android Studio, set up your Android emulator or connect a physical device. Then, navigate to your project directory and run npx react-native run-android to build and run your app in debug mode. For release builds, edit android/app/build.gradle, set up signing configs, and run cd android && ./gradlew assembleRelease. This will generate the APK in android/app/build/outputs/apk/release/. To stay updated on the latest app development trends, consider checking sosomod update for relevant tools or practices in your React Native projects.