简体   繁体   中英

How to select a default emulator for android while developing an app in react native?

I have many android emulators created on my machine. The problem is, whenever I run my react native project using 'react-native run-android', a new emulator opens even if one is already open. I would prefer to select a specific emulator that starts every time no emulator is running or if any other emulator is running. Is it possible? If yes, how?

You can do so using below command :

react-native run-android --emulator MyEmulatorName

You can get Emulator name by following commands:

adb devices // this should return like "emulator-5554"
adb -s emulator-5554 emu avd name //pass name returned in above command. You should be able to get your emulator name like "Phone_API_28" and you can pass that in first command.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM