vscode-react-native icon indicating copy to clipboard operation
vscode-react-native copied to clipboard

Debugger doesn't work (can't run on Android, on iOS console is not linked)

Open FRizzonelli opened this issue 8 years ago • 23 comments

Actual Behavior

  1. Run Debug Android
  2. Debugger doesn't start, app isn't builded and launched

Expected Behavior

  1. Run Debug Android
  2. App correctly shipped to device

Software versions

  • React-Native VS Code extension version: Latest
  • VSCode version: Latest
  • OS platform and version: OSx 10.13.5
  • NodeJS version:
  • React Native version: 0.56.0
  • Expo SDK version (include if relevant):

Outputs (Include if relevant)

  • Output of the Debug Console (View -> Toggle Debug Console):
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.
  • Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox):
[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] Using Android SDK location defined in android/local.properties file: /Users/fabriziorizzonelli/Library/Android/sdk.

[Info] Starting React Native Packager.

Scanning folders for symlinks in /Users/fabriziorizzonelli/Code/fatture-in-cloud-beta/node_modules (20ms)
Could not find device with the id: "simulator".
Choose one of the following:
[ 'XXXXXXXX' ]

This is really strange to me, I'm using this extension from like 1 year without a problem. Today all of a sudden it stopped working. I'm not able to run on Android device (which was working perfectly) and on iOS simulator the app starts but console isn't linked. The weirdest thing is that I didn't update anything, this morning was working, then it stopped 😢

Already tried to:

  • restart VSCode
  • reinstall extension
  • reinstall react-native-cli
  • restart Mac
  • clear node_modules and reinstall all dependencies
  • adb kill-server
  • set again adb reverse tcp
  • change device

I have no more ideas.. Any help is really appreciated!

FRizzonelli avatar Aug 27 '18 15:08 FRizzonelli

Running into the same issue

edwardlafoy avatar Aug 27 '18 15:08 edwardlafoy

Same problem, wasted a lot of time with it today

AndrewBoklashko avatar Aug 27 '18 15:08 AndrewBoklashko

Happens also on my mac, trying to run the same code as @FRizzonelli's

GiovanniFrigo avatar Aug 27 '18 16:08 GiovanniFrigo

Same issue. Guess it is related to the latest release (0.6.14) published today.

tbsolutions avatar Aug 27 '18 16:08 tbsolutions

Same here. RN 0.56.0 VS Code 1.26.1 RN-Tools 0.6.14 Linux Mint 16.3

...and the output of console.log is not visible in the "DEBUG CONSOLE" panel anymore :(

aMarCruz avatar Aug 27 '18 22:08 aMarCruz

Lost some hours on this issue today, simply stopped working for me too.

I can confirm that RN-Tools 0.6.14 is the problem... downgrading to 0.6.13 works fine:

Workaround for downgrading:

1.: Edit your VS Code's user setting to disable auto update by adding the following setting. "extensions.autoUpdate" : false,

2.: Download the previous version of the RN-Tools extension from this URL https://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/vsmobile/extension/vscode-react-native/0.6.13/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

3.: Rename from .VSIXPackage to .VSIX

4.: In VS Code, press CTRL + SHIFT + P or (CMD+SHIFT+P) on Mac, then type VSIX

5.:Enter the the Extension: install from VSIX command. This will launch a file picker windows.

6.: Choose the VSIX file that you've just downloaded.

7.: Reload VS code to enable the installed plug in.

vntguca avatar Aug 28 '18 02:08 vntguca

same here! Can't debug my app since 0.6.14. Downgrading work React-Native VS Code extension version: Latest VSCode version: Latest OS platform and version: Fedora 28 NodeJS version: 10 React Native version: 0.56.0 Expo SDK version (include if relevant):

abruyat avatar Aug 28 '18 07:08 abruyat

just downgraded from 0.6.14 to 0.6.13 because of 777 and then downgraded from 0.6.13 to 0.6.12 because of the issue mentioned here but even 0.6.12 has that issue so I will need to wait for the next stable version

top-master avatar Aug 28 '18 08:08 top-master

While the idea of taking the path from local.properties sounds wonderful, it also doesn't work on Windows. From Android Studio I get the recommendation to set the path as follows: sdk.dir=C \ : \ \ Users\mihai.veres\AppData\Local\Android\Sdk (extra spaces added to emphasize the actual characters)

However when the extension directly takes this path, it fails and signals that it cannot find the adb command (invalid path).

After unescaping the path above I ran into the same issue as everyone else regarding not being able to find the "simulator" device. I am not trying to run this in a simulator, but on a physical device just like before. I also "solved" the problem by reverting to 0.6.13.

Tilwin90 avatar Aug 28 '18 08:08 Tilwin90

update react-native-tools, same to me. now is 0.6.14

I also "solved" the problem by reverting to 0.6.13.

cocodevil avatar Aug 28 '18 08:08 cocodevil

My target emulated device is named emulator-5554. A step forward seems to be to add the following to .vscode/launch.json...

        "runArguments": [
            "--deviceId", "emulator-5554"
        ]

Unfortunately, this seems to cause both debug and release variants to be built. My release build fails and so debugging doesn't start.

sdc395 avatar Aug 28 '18 08:08 sdc395

Hey guys, we’ve shipped new version of extension v0.6.15 with a fix, please try it out, we are sorry for inconvenience. Let me know if you see any issues with latest version.

ruslan-bikkinin avatar Aug 28 '18 12:08 ruslan-bikkinin

Thanks for the prompt response, @ruslan-bikkinin. 0.6.15 appears to fix the could not find device with the id: "simulator" problem but I don't get any debug console output from my app. Reverting to 0.6.13 restores the console output.

sdc395 avatar Aug 28 '18 13:08 sdc395

Still no console output for me too on 0.6.15.

vntguca avatar Aug 28 '18 13:08 vntguca

Still no console output for me too on 0.6.15.

Reverting to 0.6.13 restores the console output.

Same problem.

filmhomage avatar Aug 28 '18 13:08 filmhomage

tested 0.6.15 and got below Debug Console output:

OS: win32 ia32
Adapter node: v7.9.0 ia32
vscode-chrome-debug-core: 3.17.3
Starting debugger app worker.
Established a connection with the Proxy (Packager) to the React Native application
Debugger worker loaded runtime on port 42715
******** Unhandled error in debug adapter - Unhandled promise rejection: Error: Cannot connect to runtime process, timeout after {_timeout} ms - (reason: {_error}).
    at Object.runtimeConnectionTimeout (c:\Program Files (x86)\ide\Microsoft VS Code\resources\app\extensions\ms-vscode.node-debug2\node_modules\vscode-chrome-debug-core\out\src\errors.js:91:12)
    at utils.retryAsync.catch.err (c:\Program Files (x86)\ide\Microsoft VS Code\resources\app\extensions\ms-vscode.node-debug2\node_modules\vscode-chrome-debug-core\out\src\chrome\chromeConnection.js:100:49)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:109:7)

and a long run-android output is visible in last edit of this comment

top-master avatar Aug 28 '18 14:08 top-master

Hey guys, I’m really sorry for this things happened, I’ve reverted recent changes which broke us for now and created v0.6.16. We’ll investigate and test all the things carefully again but for now things should work as usual. Again I apologise for this, will do our best to prevent such things in future.

ruslan-bikkinin avatar Aug 28 '18 15:08 ruslan-bikkinin

@ruslan-bikkinin , perhaps the isaacs' which utility is convenient for you:

const which = require('which')

/**
 * Find the first instance of the adb executable in the PATH.
 * @returns the normalized path of adb, or null if not found.
 */
function findAdbExec () {
  return which.sync('adb', { nothrow: true })
}

Also, there'are the enviroment vars ANDROID_HOME and ANDROID_SDK_ROOT, but in any case we users can specify the path to the Android SDK in a VS Code settings.

aMarCruz avatar Aug 29 '18 06:08 aMarCruz

I get the following error on the latest version of the extension, on running debug on android

OS: win32 x64 Adapter node: v8.9.3 x64 vscode-chrome-debug-core: 3.17.3 Starting debugger app worker. Established a connection with the Proxy (Packager) to the React Native application Debugger worker loaded runtime on port 34218 ******** Unhandled error in debug adapter: SyntaxError: Unexpected token L in JSON at position 0 at JSON.parse (<anonymous>) at Pipe.channel.onread (internal/child_process.js:470:28)

and also can anyone tell where can i see the console.log(), I am new to using this tool ?

and this is my launch.json

"version": "0.2.0", "configurations": [ { "name": "Debug Android", "program": "${workspaceRoot}/.vscode/launchReactNative.js", "type": "reactnative", "request": "launch", "platform": "android", "sourceMaps": true, "outDir": "${workspaceRoot}/.vscode/.react", "target": "c022be40" }

kryptonian41 avatar Aug 30 '18 14:08 kryptonian41

Hi @kryptonian41 please see this comment https://github.com/Microsoft/vscode-react-native/issues/758#issuecomment-417267137.

;TLDR This is a nodejs issue, use nodejs v10.5 or lower to avoid it until v10.10 will be released.

ruslan-bikkinin avatar Aug 30 '18 15:08 ruslan-bikkinin