Major issues trying to run react native, expo, vs code, android studio

Hello. I am brand new to React-Native and Expo. I’ve encountered major major issues at ever step of the way. It is hard to even begin because I’ve gotten so many errors and issues. Here is a very brief and incomplete rundown of the issues. I’m happy to provide more details. I feel like there is a big picture issue wrong because so many things are going wrong.

  1. Virtual Android devices constantly crash or can’t load. After this happens once I am unable to open the developer menu and must delete the virtual device.
  2. I can’t successfully run a debugger is chrome or VS code with the virtual device. The virtual device crashes and has to be deleted. At this point it would tell me in VS Code that packager was running outside VS Code. Despite closing all applications this continued.
  3. I was unable to publish to expo despite deleting the .expo file and clearing the cache.
  4. This one was the straw that broke the camel’s back. I tried deleting my app folder to get a fresh start. Windows refuses to delete because “the folder is open in another program”. As far as I can tell nothing is open!

Sorry for the non-specific post but after more than a week of fighting this I have no idea how to move forward. Any help would be much appreciated.

  1. this sounds like there is something wrong with your machine or your installation of the android virtual device. i have never encountered it and i’m not sure what has gone wrong. you can run npx react-native doctor to get more information, potentially.
  2. this sounds related to the first issue, but also there was a regression in the android client that caused issues with remote debugging on sdk 39 projects. if you were using expo client in an sdk 39 project, this may have been a cause for the issues you saw. it was fixed yesterday, so you can install the latest client from the play store or with expo client:install:android and that may help, but if your avd/android sdk installation isn’t working properly it may not. as for visual studio code, we do not work on the extension in there and do not provide support for it, but that sounds frustrating. i personally do not use vscode for debugging, remote debugging in chrome is perfectly good for me.
  3. i don’t have sufficient context, i would have to see an error message to be able to help more here.
  4. if you can reproduce this reliably after rebooting your machine please let us know what steps you follow to do so. it’s hard to say what might have gone wrong here, and what state your machine was in at that time.

it’d be great if we could always provide a very smooth experience out of the box on everyone’s computers, but this is very hard to do given the long tail of potential issues that can occur given that we are talking about building apps for ios, android, and web, from windows, linux, or mac. there is so much underlying infrastructure that we depend on to work well - android/ios sdks and tools, the user’s network, the user’s operating system, their node installation, npm/yarn, and sometimes it requires users getting crafty to debug their issues because we can’t anticipate and provide good error messages for everything. we are working towards making it as reliable as possible given the constraints, but to do that we need detailed reports when users run into unexpected situations, and sometimes we need them to contribute fixes (almost everything is open source) and debug the problems and report back on their own. a red flag for me here is that you are unable to run your avd without it crashing, which hints at something that would just create cascading failures as you try to do anything that depends on this.

2 Likes

Thanks for the input. I really appreciate it. Being inexperienced with both React-Native and Expo it has made it difficult for me to get even enough footing to start to debug, though I have done a ton of reading to try to work my way through. I guess I was hoping there might be some sort of silver bullet that I had overlooked. I hoped folks more familiar might have been able to say “Oh, sounds like you forgot to do this thing on install” or something.

After a few tries of rebooting my computer I was able to get the app to delete finally. From here my plan is to uninstall everything and start over from the beginning. I will take better notes if I continue to encounter issues and report back.

Thanks again!

1 Like

Hi.

Just a guess, but an antivirus could potentially have something open (e.g. if it’s scanning things in your node_modules directory. There are a lot of files in there usually, so it might take a bit of time.) Maybe see if you can tell your antivirus to exclude your Expo project directory.

Another thing to bear in mind: From watching the forums it appears to me that most of the people having weird problems with running Expo are running on Windows. Maybe see if you can install WSL2 (Windows Subsystem for Linux version 2). Then install Ubuntu from the Windows store. Then inside Ubuntu, install the Linux version of node and npm or yarn. Then install expo-cli using that npm or yarn and go from there. Of course a Windows antivirus could still interfere, but I think running everything under Ubuntu under WSL2 might go more smoothly.

I don’t run Expo on Windows and can’t say for sure doing the above will solve your problems, but if I were running it on Windows I’d run it on WSL2.

3 Likes

Okay. Here is what is happening. I uninstalled and reinstalled Node, Expo, and Android Studio. I deleted all previous projects. I created a new app via expo-cli. I ran npm start. The app seems to be working on my physical iPhone with reloading working. When I open an Android Virtual device and “Run on Android Device/Emulator” in metro bundler, Expo installs on the virtual device and the app successfully opens. If I make simple changes to the code (ie change the background color) it successfully automatically refreshes on the device. After about a min the app window on the device closes and goes to the Expo Projects window. Here the app I opened does not appear under “Recently Opened.” Metro Bundler seems to show that the device is still connected. At this point I closed the Expo Projects window on the device and did “Run on Android Device/Emulator” again. The app loaded again. This time I opened the developer menu and clicked “Reload”. The window showed a spinning wheel that stayed that way. Nothing would happen. I closed the expo windows on the device and tried to once again “Run on Android Device/Emulator.” This time I first received a warning “Couldn’t adb reverse: device ‘adb’ not found” and then the error “Couldn’t start project on Android: Error running adb: device ‘adb’ not found”.

It appears that the antivirius thought was correct! When I turn off ‘Windows Security real-time protection’ on my system (as described here Stay protected with Windows Security), Expo and the Android Virtual Devices are no longer crashing. I have to put in more time to figure out if this is complete solution but basic functionality, such as running a ‘reload’ from the dev menu on the device, is now working with no issues. I toggled the ‘real-time protection’ back on to check and the issues immediately reappeared.

Thanks for your help with this! I would have never thought about this interaction.

Well, I hope that does solve it, but I suggest you see if you can get it to exclude the project folder instead of turning it off completely :sweat_smile:

If you still run into problems, maybe give WSL2 a try.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.