This guide will walk you through the steps to run an Android app using React Native CLI. By following these steps, you can ensure your development environment is properly set up and your application runs smoothly on your connected device.
Steps
Step 1: Check Connected Devices
-
Connect Your Device:
- Use a USB cable to connect your PC/Mac to your testing mobile phone.
- Make sure USB debugging is enabled on your mobile phone.
-
Check Connected Devices:
- Open a terminal on your PC/Mac.
- Run the following command to check the list of connected devices:
adb devices
- This command will show a list of devices attached. If your device appears in the list, it is correctly connected.
Step 2: Clean Previous Builds
- Run the following command to clean the previous cache and builds. This helps prevent unwanted bugs:
./gradlew clean
Step 3: Run the React Native App
- Go back to the root directory of your project:
- Run the React Native App:
npx react-native run-android
- Optional: Reset Metro Bundler Cache:
npx react-native start --reset-cache
Step 4: Generate the Debug APK
Build the Debug APK:
By running the previous commands, React Native will create an APK file named debug.apk for testing purposes.
Top comments (0)