Ant*_*ray 9 javascript android android-emulator react-native react-native-android
我想同时在至少 2 个 Android 模拟器上测试我的应用程序。我可以启动 2 个模拟器,但似乎无法找到如何react-native run-android使用 ADB 在 2 个模拟器上运行我的应用程序。如果可能的话,我还希望能够react-native log-android在测试我的应用程序时在每一个上运行一个。
有没有办法这样做?
Bur*_*maz 10
只有您可以运行不同的端口。因为一个端口一个监听器:/
解决:
react-native start --port 9988
./emulator -port 9988 -avd devicename1
react-native start --port 9999
./emulator -port 9999 -avd devicename2
Run Code Online (Sandbox Code Playgroud)
在运行模拟器之前,您可以编写终端然后运行。
function emulator { cd "$(dirname "$(which emulator)")" && ./emulator "$@"; }
Run Code Online (Sandbox Code Playgroud)
第一个模拟器是react。
emulator -port 9988 @react
react-native run-android ( automaticaly detect emulator )
Run Code Online (Sandbox Code Playgroud)
第二个模拟器是r。
emulator -port 8081 @r
react-native run-android (automaticaly detect emulator )
Run Code Online (Sandbox Code Playgroud)
@Burhan Y\xc4\xb1lmaz 接受的答案对我不起作用。这可能是由于相关软件的新更新和开发所致。以下步骤演示了对我有用的方法。
\n\n启动第一个模拟器,例如\nemulator -avd Nexus_S_API_28
启动第二个模拟器,例如\nemulator -avd Nexus_S_API_28_2
以与您通常使用的相同方式启动 React-Native(不指定任何端口。) \nreact-native run-android
这会将代码的副本发送到两个设备。但是,每个设备都独立于其他设备运行其副本。
\n\n环境详情:
\n\n| 归档时间: |
|
| 查看次数: |
6893 次 |
| 最近记录: |