0
votes

My environment.

  • Windows 10 with Android SDK and AVD Manager and VS Code 1.26.1
  • Android Nexus S simulator with SDK API 23 Android 6.0 x86_64
  • react-native: 0.55.4


Problem:

I am failing to debug my sample app.js in Visual Studio Code IDE and fail to stop at any breakpoint.

I have AVD emulator running and when I simply run my simple project, the simulator loads it without issues. So, I do not see a problem with my project. I also can execute “react-native run-android” in Terminal window of VS Code IDE and it returns success, for example:

BUILD SUCCESSFUL Total time: 10.283 secs Running C:\Users\myusername\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081 Starting the app on emulator-5554 (C:\Users\myusername\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.vscodereactdebug3/com.vscodereactdebug3.MainActivity)... Starting: Intent { cmp=com.vscodereactdebug3/.MainActivity }

However, when I attempt to debug it through Visual Studio IDE (Debug/Start Debugging), the Debug Console shows the following:

OS: win32 x64 Adapter node: v8.9.3 x64 vscode-chrome-debug-core: 3.17.3 Could not debug. Unknown error: not all success patterns were matched. It means that "react-native run-android" command failed. Please, check the View -> Toggle Output -> React Native, View -> Toggle Output -> React Native: Run android output windows.


So, below is output from React Native: Run Android:

[Warning] Target simulator is not supported for Android platform. If you want to use particular device or simulator for launching Android app, please specify device id (as in 'adb devices' output) instead.

[Info] local.properties file doesn't exist. Using Android SDK location from PATH. [Info] Starting React Native Packager.

[Info] Attaching to running React Native packager

Scanning folders for symlinks in e:\Software\Android\VSCodeReactDebug3\node_modules (20ms) Could not find device with the id: "simulator".
Choose one of the following:
[ 'emulator-5554' ]

I searched forums for the greater wisdom and saw a few posts related to this erratic behavior but those, while sharing good troubleshooting clues, did not solve my problem:

https://github.com/Microsoft/vscode-react-native/issues/624

My project is very simple, almost empty few liners. So, very likely the problem is with my environment, but I cannot find anything that could explain it. I do not recall assigning ID “simulator” to anything. And do not know where it is controlled.

Any ideas are greatly appreciated.

1

1 Answers

0
votes

Update.

Today I came across of post React Native debug with Visual Studio Code not working and attempted uninstalling react-native package and installing react-native-cli. I literally ran following commands in that sequence to use create-react-native-app:

npm install react-native --global
npm uninstall -g react-native
npm install -g react-native-cli

So, now the IDE debugs and stops on breakpoints as before.

I am yet to learn what happened and why my other project suddenly stopped being debugged. I, perhaps, broke my environment attempting to recover from some other problem. And I still cannot explain the error related to "Could not find device with the id: "simulator"" in the Debug output.