Skip to content

CLI not directing the commands correctly to the correct device/emulator #1765

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
blagoev opened this issue May 16, 2016 · 6 comments
Closed
Labels

Comments

@blagoev
Copy link
Contributor

blagoev commented May 16, 2016

Currently some emulators are not recongnized as emulators and CLI is not working correctly with them

The problem manifests itself in VS Code where there are two options for debug "Launch on Android Device" and "Launch on Android Emulator". In other words there is no way for the user to use plain commands like "tns debug android" and is always specifying --emulator or --device.

The problem is the user is required to use "Launch on Android Device" for some emulators (Visual Studio Android Emulator is one) in order to get the debug session working.

For every command the CLI receives it issues multiple adb commands to the device. The correct way to work is to respect the "--emulator" given to the tns command and use "adb -e" for every adb command send to the device. This way all Android emulators will work correctly and the user will be happy selecting "Launch on Android Emulator" as expected.

this is somewhat related to #1763 since this will fix it.

@blagoev
Copy link
Contributor Author

blagoev commented May 16, 2016

We already received some issues regarding this incorrect behavior outlining the expectations of the users

nativescript-community/nativescript-vscode-extension#38
nativescript-community/nativescript-vscode-extension#23

@blagoev blagoev changed the title CLI not direct the commands correctly to the correct device/emulator CLI not directing the commands correctly to the correct device/emulator May 16, 2016
@rosen-vladimirov
Copy link
Contributor

@blagoev
May I ask you for some clarification, which are these emulators that are not recognized as emulators?

@blagoev
Copy link
Contributor Author

blagoev commented May 16, 2016

(Visual Studio Android Emulator is one)

maybe Genymotion

@blagoev
Copy link
Contributor Author

blagoev commented May 16, 2016

@rosen-vladimirov The best way of targeting the emulator is by not "recognizing it" but by redirecting communication to it. Similar how adb does it.

https://github.com/android/platform_system_core/blob/master/adb/commandline.cpp#L1480
https://github.com/android/platform_system_core/blob/master/adb/commandline.cpp#L1715-L1716

In our case this "targeting" means passing "-e" to all adb commands that correlate to the executed "tns xyz" command

@rosen-vladimirov
Copy link
Contributor

Using -e flag will work for debug command, but not for other commands as it requires only single emulator to be used. However many commands are designed to work with multiple devices. So we should check carefully and make sure other commands will work as expected.

@enchev
Copy link
Contributor

enchev commented Jul 28, 2016

Not valid with the latest VS Code run options

@enchev enchev closed this as completed Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants