Closed FrederikNJS closed 11 years ago
This is an interesting idea. I think that these commands are proliferating a little too much, I wonder if we can do some detection on the connected device(s) and automatically do the right thing with a single install- command.
+1, I was thinking about this as well.
I've looked into this a little more closely :
preload-any
/unload-any
does not detect if the target is a device or an emulator. It's bad, because, due to some restrictions in the emulator, we have to start the emulator a bit differently than usual when preloading.How does an android-target
setting key sound?
It could be set to Auto
by default, but accept Device
, Emulator
or Custom("Device-UID")
As far as I am concerned, I usually have only one device/emulator connected, so Auto
is a natural default.
If needed, it could be set in the project, or on the SBT command-line with something like set androidTarget := Emulator
.
One issue with having androidTarget
in the project files is that it would make it harder to collaborate on a project, as different developers might not want to use the same kind of target.
I set it as auto by default on my WIP branch (same as your -any
option), which should be fine for most people.
In the case you want to change it, you can just run set adbTarget := Target.Emulator
at the beginning of your session, for instance, and leave SBT running in the background as usual.
So, instead of running android:start-device
each time, you just run start
, which picks up the target you set earlier. Does that sound better?
I like that reasoning, @fxthomas. The only additional thing I can think of that might serve some developers' needs would be for Auto to apply to all connected devices rather than just the "first" matching one. Maybe this should be the default?
Do you mean that it should loop through all the devices and start the app on each one?
I disagree with this being the default, since it's fundamentally different from the expected ADB behavior. It could be an option though.
Hi,
I was in need of being able to use the android-plugin with ADB over network, so I sat down at made this.
It's actually just a version of all the -device and -emulator commands which does not add the -d og -e parameter to the adb command, this makes the command work for any android device/platform, including devices connected over the network.
The actual commands to use look like this:
and so on...
If there is any issue with the pull-request please get back to me and I will take a look at it.