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.