jberkel / android-plugin

An sbt plugin for Android development in Scala
https://groups.google.com/forum/#!forum/scala-on-android
Other
476 stars 113 forks source link

Added a workaround for ADB over network #169

Closed FrederikNJS closed 11 years ago

FrederikNJS commented 11 years ago

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:

android:start-any
android:install-any

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.

appamatto commented 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.

fxthomas commented 11 years ago

+1, I was thinking about this as well.

fxthomas commented 11 years ago

I've looked into this a little more closely :

FrederikNJS commented 11 years ago

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.

fxthomas commented 11 years ago

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?

appamatto commented 11 years ago

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?

fxthomas commented 11 years ago

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.