AutoMEta
AutoMEta

Reputation: 1351

react native android emulator issue

i have a android emulator running in my local machine with below options:

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

and i am trying to run the react native sample app on the simulator by below command

react-native run-android

it runs fine first time and my changes in the files area reflected in the app on emulator but after some time my changes are not reflected and getting error in the app

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

https://i.sstatic.net/6syRP.jpg

when launching the app again by calling

 react-native run-android

getting below error

> 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)

can someone help in identifying the problem of react native package and android emulator connectivity issue(it disconnect after some time and changes in the files are no longer can be viewed in the app on emulator)

Upvotes: 1

Views: 1849

Answers (2)

Sasongko Adi
Sasongko Adi

Reputation: 128

if you had application on your emulator, you must use react-native start if you use native code or use npm start if you use Expo on you device. And run your app on your device and do reload, so your packge server can connect to your emulator.

Upvotes: 1

Sean Song
Sean Song

Reputation: 89

Run "adb devices" in cmd. If you see "emulator-5554 offline", just do as this answer.

Upvotes: 0

Related Questions