Skip to content

Devices.NotFoundDeviceByIndexErrorMessage / Couldn't attach debugger with modified options #3891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
WouterFlorijn opened this issue Sep 13, 2018 · 3 comments
Assignees

Comments

@WouterFlorijn
Copy link

WouterFlorijn commented Sep 13, 2018

Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?

Yes, I have checked all similar issues like #976, #3679, and #3832, but none of the advice provided there works for me.

Tell us about the problem

Whenever I try to USB debug my project on my OnePlus 6, it only compiles and opens the app once. Afterwards, the command line process stops with the following error:

Unable to apply changes on device: 16089e09. Error is: Devices.NotFoundDeviceByIndexErrorMessage 16088 tns.

With --log trace, I get the following output right above the error:

Couldn't attach debugger with modified options. { Error: Cannot read property 'kill' of null
    at DevicesService.<anonymous> (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\common\mobile\mobile-core\devices-service.js:330:38)
    at Generator.throw (<anonymous>)
    at rejected (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\common\mobile\mobile-core\devices-service.js:11:65)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  allErrors:
   [ { TypeError: Cannot read property 'kill' of null
    at LogcatHelper.stop (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\common\mobile\android\logcat-helper.js:75:73)
    at AndroidApplicationManager.stopApplication (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\common\mobile\android\android-application-manager.js:106:28)
    at AndroidDebugService.<anonymous> (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-debug-service.js:153:50)
    at Generator.next (<anonymous>)
    at C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-debug-service.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-debug-service.js:3:12)
    at AndroidDebugService.debugStartCore (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-debug-service.js:152:16)
    at AndroidDebugService.<anonymous> (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-debug-service.js:131:28)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\Wouter\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-debug-service.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) deviceIdentifier: '16089e09' } ] }

I've tried downgrading my CLI, and Android runtimes to one or two minor releases earlier, but got the same issue. Note that this issue doesn't occur with an emulator.

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.2.3
  • Cross-platform modules: 4.2.0
  • Runtime(s): 4.2.0
  • Plugin(s):
    • "nativescript-dev-webpack": "^0.15.0",
    • "nativescript-vue-template-compiler": "^1.3.1",
    • "nativescript-worker-loader": "~0.9.0",
  • I'm using the next branch of the vue-cli-template

Please tell us how to recreate the issue in as much detail as possible.

Create a new project using

vue init nativescript-vue/vue-cli-template#next <project-name>

Run using

tns debug android --bundle
@rosen-vladimirov
Copy link
Contributor

Hey @WouterFlorijn ,
Thanks for reporting this issue. It is related to your device identifier, which is treated as number by NativeScript CLI which causes the issue.
Can you try opening <cli installation dir>/lib/common/mobile/mobile-core/devices-service.js and replace all occurrences of helpers.isNumber with _.isNumber, similar as I've done here. Does this resolve the issue on your side?

@rosen-vladimirov
Copy link
Contributor

EDIT: It seems using lodash's _.isNumber breaks other functionality in CLI, so I had to apply some other changes in the helpers.isNumber method, you can check them here.

@rosen-vladimirov
Copy link
Contributor

Hey @WouterFlorijn , I'm closing this thread as a duplicate of #3832, we can continue the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants