Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-27456

Emulator can't connect to adb server!?

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The emulator plugin can't connect the adb server as already discussed in ticket. I don't know if it is a misconfiguration problem or the previously mentioned problems still exists?

      [EnvInject] - Loading node environment variables.
      Baue in Arbeitsbereich /var/lib/jenkins/jobs/xxx/workspace
      Updating https://abc.xyz/xxx/trunk/src_androidstudio at revision '2015-03-17T08:58:35.873 +0100'
      At revision 693
      no change for https://abc.xyz/xxx/trunk/src_androidstudio since the previous build
      [android] Using Android SDK: /opt/android-sdk_r24.0.2-linux
      [android] Waiting 30 seconds before starting emulator...
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb start-server
      * daemon not running. starting it now on port 9278 *
      * daemon started successfully *
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb start-server
      $ /opt/android-sdk_r24.0.2-linux/tools/emulator -snapshot-list -no-window -avd hudson_de-DE_160_WXGA800_android-19_armeabi-v7a
      [android] Starting Android emulator and creating initial snapshot
      [android] Erasing existing emulator data...
      $ /opt/android-sdk_r24.0.2-linux/tools/emulator -no-boot-anim -ports 9276,9277 -avd hudson_de-DE_160_WXGA800_android-19_armeabi-v7a -no-snapshot-load -no-snapshot-save -wipe-data -no-window -no-audio -gpu off
      Failed to Initialize backend EGL display
      Could not initialize emulated framebuffer$ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      connected to localhost:9277
      [android] Waiting for emulator to finish booting...
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb disconnect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb disconnect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb disconnect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb -s localhost:9277 shell getprop init.svc.bootanim
      error: device offline
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb connect localhost:9277
      [android] Interrupted while waiting for emulator to finish booting.
      [android] Emulator was shut down before it finished booting
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb disconnect localhost:9277
      [android] Stopping Android emulator
      Creating filesystem with parameters:
          Size: 69206016
          Block size: 4096
          Blocks per group: 32768
          Inodes per group: 4224
          Inode size: 256
          Journal blocks: 1024
          Label: 
          Blocks: 16896
          Block groups: 1
          Reserved block group size: 7
      Created filesystem with 11/4224 inodes and 1302/16896 blocks
      emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
      $ /opt/android-sdk_r24.0.2-linux/platform-tools/adb kill-server
      [...]
      

        Attachments

          Activity

          Hide
          andyp1per Andy Piper added a comment -

          The command:
          adb -s localhost:9277 shell
          is completely wrong. The docs say:
          -s <specific device> - directs command to the device or emulator with the given
          serial number or qualifier. Overrides ANDROID_SERIAL
          So this is not a host and port, it's an identifier. If I run the create command that jenkins uses I get the identifier:
          emulator-5554
          If I use this to connect all is good. So I believe the plugin is completely broken in its current behaviour.
          The docs are also wrong ANDROID_SERIAL lists hosts:port but it should be an identifier. I don't currently see a way of setting this, but I haven't looked very hard.

          Show
          andyp1per Andy Piper added a comment - The command: adb -s localhost:9277 shell is completely wrong. The docs say: -s <specific device> - directs command to the device or emulator with the given serial number or qualifier. Overrides ANDROID_SERIAL So this is not a host and port, it's an identifier. If I run the create command that jenkins uses I get the identifier: emulator-5554 If I use this to connect all is good. So I believe the plugin is completely broken in its current behaviour. The docs are also wrong ANDROID_SERIAL lists hosts:port but it should be an identifier. I don't currently see a way of setting this, but I haven't looked very hard.
          Hide
          andyp1per Andy Piper added a comment -

          According to this:
          http://stackoverflow.com/questions/2214377/how-to-get-serial-number-or-id-of-android-emulator-after-it-runs
          The emulator name is "emulator-X" where X is the console port defined when you start the emulator.

          Show
          andyp1per Andy Piper added a comment - According to this: http://stackoverflow.com/questions/2214377/how-to-get-serial-number-or-id-of-android-emulator-after-it-runs The emulator name is "emulator-X" where X is the console port defined when you start the emulator.
          Hide
          jwstric2 Jonathan Strickland added a comment -

          Related to https://issues.jenkins-ci.org/browse/JENKINS-11952 ... I see this is where a change took place to fix some instability but as noted here with the latest version downloaded from the job (Downloading and installing Android SDK from http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz) the syntax localhost:<adb port> doesn't appear to be valid:

          /android_gradle_integration_matrix/label/trust-reg-3.cisco.com
          $ /home/testuser/tools/android-sdk/tools/android list target
          [android] Using Android SDK: /home/testuser/tools/android-sdk
          $ /home/testuser/tools/android-sdk/platform-tools/adb start-server
          * daemon not running. starting it now on port 8711 *
          * daemon started successfully *
          $ /home/testuser/tools/android-sdk/platform-tools/adb start-server
          [android] Starting Android emulator
          $ /home/testuser/tools/android-sdk/tools/emulator -ports 8709,8710 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_HVGA_android-16_armeabi-v7a -no-snapshot-load -no-snapshot-save -no-window -noaudio
          $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710
          unable to connect to localhost:8710: Connection refused
          [android] Waiting for emulator to finish booting...
          $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim
          error: device 'localhost:8710' not found
          $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710
          $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim
          error: device 'localhost:8710' not found
          $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710
          $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim
          error: device 'localhost:8710' not found
          $ /home/testuser/tools/android-sdk/platform-tools/adb disconnect localhost:8710
          error: no such device 'localhost:8710'
          $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710
          $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim
          error: device 'localhost:8710' not found
          $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710
          $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim
          error: device 'localhost:8710' not found
          $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710
          $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim
          error: device 'localhost:8710' not found
          ....
          

          Run it manually on the same box with the notes from above:

          [testuser@trust-reg-3 ~]$ /home/testuser/tools/android-sdk/platform-tools/adb devices
          List of devices attached
          emulator-5035   device
          [testuser@trust-reg-3 ~]$ /home/testuser/tools/android-sdk/platform-tools/adb -s emulator-5035 shell
          root@android:/ # exit
          

          The fix looks as simple as the below diff; but seems we would need to either make a decision of push the throttle down to keep the train going with the latest release or add different contextes to support the older versions for those where localhost:<port> is a more valid stable way to connect to the emulator.

          jonatstr-onec:/ws/jonatstr-rtp/workspace/android-emulator-plugin > git diff src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContext.java
          diff --git a/src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContex
          index 1d3eac9..1e5d992 100644
          --- a/src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContext.java
          +++ b/src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContext.java
          @@ -55,7 +55,7 @@ public class AndroidEmulatorContext {
                          adbPort = ports[1];
                          adbServerPort = ports[2];
          
          -               serial = String.format("localhost:%d", adbPort);
          +               serial = String.format("emulator-%d", adbPort);
                  }
          
                  public void cleanUp() {
          (END)
          
          Show
          jwstric2 Jonathan Strickland added a comment - Related to https://issues.jenkins-ci.org/browse/JENKINS-11952 ... I see this is where a change took place to fix some instability but as noted here with the latest version downloaded from the job (Downloading and installing Android SDK from http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz ) the syntax localhost:<adb port> doesn't appear to be valid: /android_gradle_integration_matrix/label/trust-reg-3.cisco.com $ /home/testuser/tools/android-sdk/tools/android list target [android] Using Android SDK: /home/testuser/tools/android-sdk $ /home/testuser/tools/android-sdk/platform-tools/adb start-server * daemon not running. starting it now on port 8711 * * daemon started successfully * $ /home/testuser/tools/android-sdk/platform-tools/adb start-server [android] Starting Android emulator $ /home/testuser/tools/android-sdk/tools/emulator -ports 8709,8710 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_HVGA_android-16_armeabi-v7a -no-snapshot-load -no-snapshot-save -no-window -noaudio $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710 unable to connect to localhost:8710: Connection refused [android] Waiting for emulator to finish booting... $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim error: device 'localhost:8710' not found $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710 $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim error: device 'localhost:8710' not found $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710 $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim error: device 'localhost:8710' not found $ /home/testuser/tools/android-sdk/platform-tools/adb disconnect localhost:8710 error: no such device 'localhost:8710' $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710 $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim error: device 'localhost:8710' not found $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710 $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim error: device 'localhost:8710' not found $ /home/testuser/tools/android-sdk/platform-tools/adb connect localhost:8710 $ /home/testuser/tools/android-sdk/platform-tools/adb -s localhost:8710 shell getprop init.svc.bootanim error: device 'localhost:8710' not found .... Run it manually on the same box with the notes from above: [testuser@trust-reg-3 ~]$ /home/testuser/tools/android-sdk/platform-tools/adb devices List of devices attached emulator-5035 device [testuser@trust-reg-3 ~]$ /home/testuser/tools/android-sdk/platform-tools/adb -s emulator-5035 shell root@android:/ # exit The fix looks as simple as the below diff; but seems we would need to either make a decision of push the throttle down to keep the train going with the latest release or add different contextes to support the older versions for those where localhost:<port> is a more valid stable way to connect to the emulator. jonatstr-onec:/ws/jonatstr-rtp/workspace/android-emulator-plugin > git diff src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContext.java diff --git a/src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContex index 1d3eac9..1e5d992 100644 --- a/src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContext.java +++ b/src/main/java/hudson/plugins/android_emulator/AndroidEmulatorContext.java @@ -55,7 +55,7 @@ public class AndroidEmulatorContext { adbPort = ports[1]; adbServerPort = ports[2]; - serial = String.format("localhost:%d", adbPort); + serial = String.format("emulator-%d", adbPort); } public void cleanUp() { (END)
          Show
          orrc Christopher Orr added a comment - https://github.com/jenkinsci/android-emulator-plugin/pull/58
          Hide
          orrc Christopher Orr added a comment -

          This should be working in version 2.14 of the plugin, which was released last week.

          Show
          orrc Christopher Orr added a comment - This should be working in version 2.14 of the plugin, which was released last week.

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              arbyter Marcus Sümnick
            • Votes:
              2 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: