Nativescript-cli: Run/debug commands should not try to deploy on connected but not paired devices

Created on 27 Jun 2016  路  7Comments  路  Source: NativeScript/nativescript-cli

Steps to repro:

  1. Connect an android device via USB but do not allow USB debugging
  2. Execute tns run/debug command

Expected result: Emulator is started if no other paired device is running
Actual result: A message that deployment is successful appears, but the app is not actually deployed

bug android

Most helpful comment

For guys seeing this in the future:

I had the same error on the emulator running Android7.0 (the one with GooglePlay app preinstalled).
Turning on USB debugging inside the emulator (setting->Developer options) fixed the problem.

All 7 comments

Expected behavior:
Please vote for the expected behavior in the following scenario:
You have connected a device but this device is not authorized. What should happen when you run: tns run android command:

  • option 1: warning: this device is not authorized(paired) so we'll start the default emulator
  • option 2: warning: this device is not authorized(paired) + kill process + message: if you want to run the application with an emulator please run tns run android --emulator
  • option 3: error: this device is not authorized + kill the process

Ping: @NativeScript/android-runtime @dtopuzov @vchimev @yyosifov

@Plamen5kov based on my experience with the CLI, I would consider option 2 as the way to go. More often than not I would connect an unathorized device that I just forget to pair to the PC. If a native emulator was to boot up it would most likely be slow because I can either use HAXM + native emulator or Genymotion setup, and I prefer Genymotion.

Is there a mechanism in place to check whether a device is connected, but not paired (or no usb debugging enabled)? We can also list all paired devices (similar to what tns devices would output) if tns run fails.

@Pip3r4o connected, but not paired devices are displayed by tns device command like:

|device id | status |
|-|-|
|some_id | unauthorized|

The current exception is: device is not authorized, so displaying tns device result, would be pretty much the same as the exception.

@Plamen5kov My favorite is option2, but I'll be happy with all the options in general.

Implementing:
error: this device is not authorized(paired) + kill process + message: if you want to run the application with an emulator please run tns run android --emulator
by popular vote.

Actual result with {N} CLI 3.0.0-2017.4.21.1

Skipping prepare.
Searching for devices...
Skipping package build. No changes detected on the native side. This will be fast!
Multiple errors were thrown:
The device is not authorized. Please use the --emulator flag to run the application on on an emulator

Looks ok to me.

For guys seeing this in the future:

I had the same error on the emulator running Android7.0 (the one with GooglePlay app preinstalled).
Turning on USB debugging inside the emulator (setting->Developer options) fixed the problem.

Was this page helpful?
0 / 5 - 0 ratings