【问题标题】:react native android emulator issue反应原生android模拟器问题
【发布时间】:2017-04-12 07:09:13
【问题描述】:

我有一个在我的本地机器上运行的安卓模拟器,有以下选项:

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

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

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)

有人可以帮助确定反应原生包的问题吗 和android模拟器连接问题(一段时间后断开连接 并且文件中的更改不再可以在应用程序上查看 模拟器)

【问题讨论】:

  • 运行 react-native run-android 命令后。您必须在项目文件夹中使用 react-native start 命令启动服务器。然后重新加载你的应用程序。
  • 我第一次没有使用“react-native start”命令,它工作正常

标签: android react-native android-emulator react-native-android


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    在 cmd 中运行“adb devices”。如果您看到“emulator-5554 offline”,请按照answer 操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多