Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12661] CLI: Support adb's -s option for pointing a build to a specific emulator or device

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-10-19T01:22:31.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2013 Sprint 21, 2013 Sprint 21 Core, Release 3.2.0
ComponentsAndroid, Tooling
Labelsandroid, androidbuild, ay-verified, cb-verified, cli, module_CLI
ReporterTony Lukasavage
AssigneeChris Barber
Created2013-02-11T16:54:58.000+0000
Updated2013-12-06T17:56:08.000+0000

Description

It would be extremely helpful, and give the CLI more power with Android, if developers were able to specify specifically which device or emulator for which they would like to build. Right now the build process allows us to specify and avd id which would let you pick an emulator, but even that is not ideal as you don't really have a way of knowing an emulator's id from the *android list avd* as it isn't listed. Ideally, I should be able to call *adb devices*, see my listing of emulators and devices, than be able to pass that serial number to the *titanium build* command as an option, directing the build process to that specific emulator or device. The build process _tries_ to be intelligent about this, but more often than not I get errors like: * It fails if there is a connected device AND an emulator open * Even with an emulator already it open, it often attempts to load an entirely different one * Tries to use emulators not compatible with the app (like a non-Google API emulator with an app that uses maps) Allowing a command like the following would make it really easy for developers to have multiple open emulators and connected devices and still get expected behavior:
titanium build -p android -s EMULATOR_OR_DEVICE_SERIAL
Obviously I leave the choice of the option flag to the implementor. "-s" would correspond to the adb command, but this is already in use for *titanium build* for specifying the target Titanium SDK.

Comments

  1. Metal3d 2013-03-05

    I agree with the proposition. I'm working on a laptop with a little resolution and I didn't found a way to work out Titanium Studio to launch my app in a specific emulator (that I launch with -scale option to scale down resolution). I'm working on VIM. Alloy had a "run" command that launched application on current emulator... but since 1.0.0 version this command is deprecated and we must use titanium command. BTW I didn't found how you passed serial to titanium build command (I tried to check titanium help build that speaks about id, skin... but no serial)
  2. Fokke Zandbergen 2013-09-11

    Any updates on this? This would really help testing on specific Android configurations, not just SDK and ABI.
  3. Chris Barber 2013-09-11

    [~fokke] Good news is I just added support for specifying an emulator or device. Bad news is it won't ship until 3.2.0 ships. You'll be able to have multiple devices plugged in and/or multiple emulators running. You just specify the name of the device/emulator.
  4. Shannon Hicks 2013-09-11

    This is related to TIMOB-7053 too. Would be good if TiStudio had a GUI so we could pick the device from a drop down.
  5. Chris Barber 2013-09-11

    @Shannon, yup, Studio will be able to retrieve a list of all emulators/devices via the "ti info" command and present you with a drop down.
  6. Allen Yeung 2013-10-19

    PR: https://github.com/appcelerator/titanium_mobile/pull/4781
  7. Tony Lukasavage 2013-12-03

    This ticket isn't actually resolved, unless there are undocumented options that aren't shown in ti help build. The request was for the ability to target an emulator or device based on the serial number (returned by adb devices. This seems to go by the avd name by default or the device name when used with -T device, which is not shown in adb devices. As stated above, targeting by serial number is the equivalent of the "-s" option in "adb", as a point of reference. The resolution to this ticket provides a similar solution, but doesn't actually resolve the request of targeting by serial number. I would still like it if an option could be added to the android build process that allowed for this functionality.
  8. Chris Barber 2013-12-03

    [~tlukasavage] Run "ti help build", then look for "--device-id". You can call "ti build -p android -T device --device-id foo" and it'll prompt you with a list of connected devices.
  9. Tony Lukasavage 2013-12-03

    [~cbarber] right, I'm familiar with that behavior. That's not connecting via serial number though, which is easily viewable, not to mention parseable for automation, from adb devices.
  10. Chris Barber 2013-12-03

    [~tlukasavage] I guess what I meant to say is --device-id EXPECTS the device name returned from adb devices, right?
  11. Eric Merriman 2013-12-05

    To test: Attach two devices/emulators, specify the --device-id of the one you wish. Also, try (on device, may not work for emulator) "--device-id all" and the api should ins all on all connected devices
  12. Lokesh Choudhary 2013-12-06

    Verified by following the steps Eric mentioned. Environment: Appcel Studio : 3.2.0.201312042306 Ti SDK : 3.2.0.v20131204220843 Mac OSX : 10.8.5 Alloy : 1.3.0-beta CLI - 3.2.0-beta Samsung Galaxy S4 running android 4.2.2 Nexus 5 - android 4.4

JSON Source