[
https://issues.jenkins-ci.org/browse/JENKINS-12821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159349#comment-159349
]
Richard Mortimer commented on JENKINS-12821:
--------------------------------------------
Problem found. Unfortunately it is deep in the emulator (qemu) startup code.
The following code registers the emulator instance with the adb server.
{code}
qemu-setup.c:
sprintf(tmp,"0012host:emulator:%d",base_port+1);
socket_send(s, tmp, 18+4);
{code}
This registers the emulator with the adb server but it makes two assumptions:
# that the user port is one less than the adb port for the emulator. Comments
in the code also suggest that the user port was once assumed to be an even
number. The server takes the adb port number supplied and subtracts one to get
the user port. It then tries to connect to the user port to confirm that it
really is an emulator.
# only 4 characters of the adb port number is sent to the adb server (the +4 in
socket_send). Thus if the port number is greater than 9999 or less than 1000
then the wrong port number is sent.
I haven't searched the Android bug database for this yet but will search/report
there later today.
However that does not make things work for a-e-p because we will need to
support older emulators.
I tested a fix that uses the Jenkins port allocator to allocate 7000 for user
port, 7001 for emulator adb port and then 8000 for the adb server. With that
maven happily worked using {{-Dandroid.device=emulator}}.
{code}
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter set to emulator
[INFO] checking
device=emulator-6000_hudson_en-GB_160_WVGA_android-7_unknown_sdk, port=8000,
name=hudson_en-GB_160_WVGA_android-7, isEmulator=true
[INFO] Emulator emulator-6000_hudson_en-GB_160_WVGA_android-7_unknown_sdk found.
{code}
Obviously to provide a proper fix we need to do some magic with the port
allocator plugin. Assuming that it is acceptable that we require a newer port
allocator plugin for a-e-p then I'll look to extend that to help us. Failing
that we can likely make the existing allocator work with a bit of messing
around.
> android.device
> ---------------
>
> Key: JENKINS-12821
> URL: https://issues.jenkins-ci.org/browse/JENKINS-12821
> Project: Jenkins
> Issue Type: Bug
> Components: android-emulator
> Affects Versions: current
> Reporter: Sebastian Schefczyk
> Assignee: Richard Mortimer
> Priority: Minor
>
> The following configuration of the android-maven-plugin will not find the
> running emulator on Jenkins.
> Commenting this line will find the emulator.
> On my local machine this is working fine, but not in Jenkins.
> Both machines use maven 3.0.4 on Linux/Ubuntu.
> <groupId>com.jayway.maven.plugins.android.generation2</groupId>
> <artifactId>android-maven-plugin</artifactId>
> <configuration>
> ...
> <device>emulator</device>
> ...
> </configuration>
> </plugin>
> This configuration is useful on the local machine, if you are developing
> while charging your phone via USB.
> Best regards, that's a really nice plugin!
> Sebl29
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira