Expo fails to open on virtual android device


#1

Hello,

I have my emulated android device running, its visible in “adb devices” and in expo I hit “open on android device” and the reactive native package manager in says “Opening on Android device” then nothing happens… and the emulator just stays there on the home screen / nothing installed.

Any idea whats going on or how to debug it as I see no logs anywhere? It works when I share to my actual phone.

Its the visual studio android emulator as I 100% have to run hyper-v given my work environment. Hyper-v means genymotion and the google android emulators are not viable as they require VirtualBox and are incompatible with hyper-v, so there is absolutely no way I can use them / this VS emulator is my only option.

The VS emulator didnt work at first, but adding the android studio adb version to path and a windows reg key to it seems to have worked, i.e. I can open a console and type adb devices and the virtual device is listed ok.

Expo seems to talk to the virtual device, if I open a 4.4 android and open on android device I get loads of error text in in the expo react native consol saying cant adb reverse which I later found out is supported in android 5.0.0 + devices.

So with an android 6 device that isnt an issue / expo seems to be using the same adb / is talking to the virtual device. Just nothing happens.

Whats frustrating is I can see no log out put, no time out, or error saying cant deploy etc I have nowhere to start to try and make this work. From what I read, people have made this work with the VS android emulator so its possible.

Any help would be most most appreciated, started a new job and this is making everything slow. Other team members have macs and everything just seems to work easily.

Thanks


#2

Sorry you’re running into trouble. So here’s the command it’s running behind the scenes when it claims to be opening the project. Maybe try running that manually and see what happens?

If you need to access your project manually, you can open the Expo app on your emulator, then paste in the URL shown for your project.

@jesse do you have any advice about this particular emulator setup? I’m not familiar. Seems difficult to debug if there aren’t any logs.


#3

Thanks for the help, sorry been caught up with work / been meaning to reply.

I couldn’t get it working in the end. There were a few weird things I found, primarily hyper-v doesnt create an external network interface for the phone VM, if you go into the hyper-v manager and set it up whilst making sure its listed after its internal network adapter (because the order you specify devices is important?!) then expo half works.

Half works as in it starts expo app on the emulator and then hangs / fails. At that point I suspected the compatibility problem goes past just getting adb to work / the right path.

So I made the switch to linux, after an inotify issue and adb path, it (seemingly) works fine :slight_smile: Also, means there is no hyper-v requirement and I can just use virtual box / the standard android emulator which just works.

Thanks again.


#4

I’ve also run into this issue as well. Networks on my emulator are setup correctly and do work fine from Android Studio, however when I send the command to run on the emulator from my react native project the expo client is loaded onto the emulator, the console prints out running android… but nothing happens. If I try to launch expo on the emulator to just type in the url it opens and crashes right away.


#5

I experienced similar symptoms. One day Expo was loading my app just fine, the next day it was not. Once I got stuck in this state, I could reproduce the issue even with a brand new app. I ran these commands:
expo init myapp
(created a blank app)
cd myapp
yarn start

The Android app would launch in the simulator with a blank white screen. Expo’s CLI output said “Opening on Android device”, but nothing printed beyond that. I tried saving an arbitrary text change to the App.js file, and saw no console output – no indication that even the watcher loop was online.

I then tried running “expo build:android”, and saw this error:
Must specify a java package in order to build this experience for Android. Please specify one in app.json at “expo.android.package”

So I filled in this section in my app.json:
“ios”: {
“supportsTablet”: true,
“bundleIdentifier”: “com.mycompany.app”
},
“android”: {
“package”: “com.mycompany.app”
}

I re-ran “expo build:android” and it successfully built the JavaScript bundle.

Next, I ran “yarn start”, and still the app was not loading. Same symptoms.

I launched the Expo web console and noticed that the “Connection” button was set to “LAN”. I toggled it to “Local”, and voila, everything started working again. Expo built the JavaScript bundle, and the app loaded in the android emulator.