Skip to content
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

x/mobile/cmd/gomobile: support '-s' option in gomobile install command #15349

Closed
yyoon opened this issue Apr 18, 2016 · 3 comments
Closed

x/mobile/cmd/gomobile: support '-s' option in gomobile install command #15349

yyoon opened this issue Apr 18, 2016 · 3 comments

Comments

@yyoon
Copy link

yyoon commented Apr 18, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
go version go1.6 linux/amd64
  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/youngseokyoon/go:/usr/local/google/home/youngseokyoon/Programming/vanadium/release/go:/usr/local/google/home/youngseokyoon/Programming/vanadium/release/projects/go"
GORACE=""
GOROOT="/usr/lib/google-golang"
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -gno-record-gcc-switches -fdebug-prefix-map=/tmp/go-build010600656=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?

After running go get -d golang.org/x/mobile/example/basic, tried gomobile install golang.org/x/mobile/example/basic while multiple devices are connected at the same time.

$ gomobile install golang.org/x/mobile/example/basic
error: more than one device/emulator
- waiting for device -
error: more than one device/emulator
- waiting for device -
error: more than one device/emulator
- waiting for device -
error: more than one device/emulator
- waiting for device -
error: more than one device/emulator
- waiting for device -
(these two lines appear indefinitely...)
  1. What did you expect to see?

I expected that there would be a command line flag for specifying a device serial number in gomobile install. For example, providing an optional -s <serial number> flag as in adb would be sufficient:

gomobile install -s <serial number> golang.org/x/mobile/example/basic

Please see: http://developer.android.com/tools/help/adb.html#directingcommands

We are experimenting with some multi-device mobile apps (i.e. same app running on multiple devices simultaneously) built with gomobile, and this limitation of gomobile install command significantly slows down our implement/test cycle.

  1. What did you see instead?

gomobile install expects that there is only a single device connected. The command runs indefinitely until there is only one active device.

@bradfitz bradfitz added this to the Unreleased milestone Apr 19, 2016
@bradfitz
Copy link
Contributor

/cc @crawshaw @hyangah

@dskinner
Copy link
Member

This was on my radar before I got busy with other things, though I was only looking at adb -d and adb -e flags for one-off convenience.

As I understand it, right now gomobile install only deals with android, but that may not be the case in the future given the implicit -target=android? In that case, polluting the accepted args with adb specific flags seems not great.

@yyoon your actual use case should be addressable without any change using the env var ANDROID_SERIAL. For example, I just tested this and it works ok while also having a hardware device connected:

ANDROID_SERIAL=emulator-5554 gomobile install

As far as slowing down the build/test cycle, it looks like gomobile install always performs a build so you'd actually want to do something like

gomobile build
adb install -s <id0> -r app.apk
adb install -s <id1> -r app.apk
...

instead of calling gomobile install multiple times.

@yyoon
Copy link
Author

yyoon commented Apr 28, 2016

Ah, I see. Thanks for the response. I like your second suggestion of doing build and install separately.
I'll close this issue.

@yyoon yyoon closed this as completed Apr 28, 2016
@golang golang locked and limited conversation to collaborators Apr 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants