反应原生安卓模拟器问题



我的本地机器中运行了一个Android模拟器,具有以下选项:

emulator.exe -avd Nexus_5_API_22 -netdelay none -netspeed full

我正在尝试通过以下命令在模拟器上运行 React 本机示例应用程序

react-native run-android

它第一次运行良好,我在文件区域中的更改反映在模拟器上的应用程序中,但一段时间后我的更改没有反映出来并在应用程序中出现错误

[![![enter image description here][1]][1]

https://i.stack.imgur.com/6syRP.jpg

通过调用再次启动应用程序时

 react-native run-android

低于错误

> Exception in thread "Device List Monitor"
> java.lang.NullPointerException
>         at com.android.ddmlib.EmulatorConsole.checkConnection(EmulatorConsole.java:317)
>         at com.android.ddmlib.EmulatorConsole.getConsole(EmulatorConsole.java:231)
>         at com.android.ddmlib.DeviceMonitor.queryAvdName(DeviceMonitor.java:248)
>         at com.android.ddmlib.DeviceMonitor.updateDevices(DeviceMonitor.java:220)
>         at com.android.ddmlib.DeviceMonitor.access$400(DeviceMonitor.java:65)
>         at com.android.ddmlib.DeviceMonitor$DeviceListUpdateListener.deviceListUpdate(DeviceMonitor.
> java:662)
>         at com.android.ddmlib.DeviceMonitor$DeviceListMonitorTask.processIncomingDeviceData(DeviceMo
> nitor.java:847)
>         at com.android.ddmlib.DeviceMonitor$DeviceListMonitorTask.run(DeviceMonitor.java:781)
>         at java.lang.Thread.run(Thread.java:745)

有人可以帮助识别 React 本机包的问题吗 和安卓模拟器连接问题(一段时间后断开连接( 并且文件中的更改不再可以在应用程序中查看 模拟器(

如果你的模拟器上有应用程序,你必须使用 如果您使用本机代码,react-native start,如果您在设备上使用 Expo npm start则使用。并在您的设备上运行您的应用程序并重新加载,以便您的打包服务器可以连接到您的模拟器。

在cmd中运行"adb devices"。 如果您看到"模拟器-5554脱机",请按照此答案进行操作。

最新更新