[React Native(RN)/Android] How can i App build Android Simulator or Real Device Change?



1. Problem

$ react-native run-android
or
$ yarn nx run-android mobile
or
$ npx react-native run-android

If you proceed with the mobile build with the above command, you can only check the basic simulator. If i want to change to android simulator or real device phone. How can I change the simulator?

2. Solution

First, you can confirm your simulator devices.

$ adb devices

You can confirm your devices id and model name.

$ adb devices
List of devices attached
ABCDEDDDD     device
emulator-0000   device

And you can solve this problem. --deviceId=DEVICE_ID is good option.

$ react-native run-android --deviceId=DEVICE_ID
or
$ yarn nx run-android mobile --deviceId=DEVICE_ID
or
$ npx react-native run-android --deviceId=DEVICE_ID

Now, you can boot another device! Thanks for your read this article.


reference

  • https://stackoverflow.com/questions/40725219/react-native-run-android-on-specific-device