"ant install" indeed only work with a single device running, but adb
-s <serial> install is the same thing really. Nothing magical about
"ant install" :)

To figure out the serial number of each AVD, you could run DDMS. it
displays the avd name in the last column of the Device tree view.

You could also use the following commands to do some script wizardry
that displays the avd for the current emulators:

adb devices - list the connected devices. Emulators will show up as
"emulator-<port>"
telnet localhost <port> - connect to the emulator console running on <port>
avd name - inside the emulator console, returns the avd name.

Xav

On Thu, Apr 16, 2009 at 9:47 AM, a druid <[email protected]> wrote:
>
>
>
> On Apr 16, 5:56 pm, David Turner <[email protected]> wrote:
>> On Thu, Apr 16, 2009 at 5:25 PM, a druid <[email protected]> wrote:
>>
>> > Hi,
>>
>> > What I understood.
>>
>> > I have to create two avds
>>
>> > I did this with
>> > android create -avd --name d1 --target 2 --sdcard 1024M --skin HVGA
>> > android create -avd --name d2 --target 2 --sdcard 1024M --skin HVG
>>
>> > What I don't know:
>>
>> > How to start two emulators:
>> > ------------------------------------------
>> > emulator '@d1' &
>> > works fine
>>
>> > emulator '@d2' &
>> > complains with
>> > "could not bind server socket address 127.0.0.1:15555: Address already
>> > in use"
>>
>> Actually, this is just a warning message that should really not be displayed
>> normally
>> (i.e. it's a minor bug that the message is displayed here). It just means
>> that the second
>> emulator will use port 5556 as its console number (while the first one will
>> use 5554)
>>
>> > Both emulators consume seem to start up though.
>> > What features won't work for the second emulator.
>> > Do I have to manually specify a port or is there some automatic
>> > option?
>>
>> No, ignore the message, everything should work correctly in each emulator.
>>
>>
>>
>> > How to upload an application to one platform:
>> > --------------------------------------------------------------------
>>
>> adb -s emulator-5554 install <package> to upload to the first emulator
>> adb -s emulator-5556 install <package> to upload to the second one
>>
>> the "-s <serial>" option is used by adb to target a given device by its
>> "serial number"
>> for emulators, the serial number is 'emulator-<port>', where <port> is the
>> console
>> control port that is also displayed in the emulator's window title.
>>
>>
>>
>>
>>
>> > How to install to  d1 / d2:
>> > ------------------------------------
>>
>> > When creating a project I am only asked for the target, but not for
>> > the device so I assume it must be a run time ant switch.
>>
>> > ant debug
>> > will compile my project
>>
>> > ant install
>> > or ant reinstall
>>
>> > complains with the error message 'more than one device and emulator'
>> > So I guess, that there is a way to specify the target device.
>>
>> > ant help
>> > does not reveal anything useful
>>
>> Ant is a very complex beast :-) I don't know how one can specify a target
>> emulator from the command-line. There should be a way because the ADT plugin
>> does this properly and invokes Ant internally. Sorry, I can't help you right
>> now
>> but will try to have a look at it.
>>
>>
>>
>
> David,
>
>
> Thanks a lot.
>
> the adb command line is fine for me.
> I'll do now:
>
> ant debug && adb -s emulator-5554 install <package>
>
>
> What is a little annoying is though, that I don't know how to
> establish a direct mapping between an avd and the port name, that it
> is using.
>
> So depending on whether I started the emulator for device d1 before
> device d2 or
> vice versa  I have to adapt the adb device name.
>
> This is no killer at all, but I'd be curious whether anybody had an
> idea of how to do this nicely.
>
> The only very clumsy idea, that I have:
>
> - the lock file in ~/.android/avd/<Device>.avd/*.lock just reveals the
> process id
>
> - netstat -p | grep 'tcp' | grep $processid
> returns the emulator port
>
> -  and emulator port - 1 will allow me to determine the device name,
> that I had to use
> for adp install.
>
>
> >
>



-- 
Xavier Ducrohet
Android Engineer, Google.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to