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

Android Emulator Plugin looks in workspace to find existing AVD

      The plugin looks in the workspace directory when searching for the specified AVD. The AVD (named "Image") is present in ~/.android/avd, but it looks in ~/workspace/<test-name>/.android/avd instead.

      15:59:12 FATAL: /Users/lkung/workspace/appium-android-test/.android/avd/Image.ini (No such file or directory)
      15:59:12 java.io.FileNotFoundException: /Users/lkung/workspace/appium-android-test/.android/avd/Image.ini (No such file or directory)
      15:59:12 at java.io.FileInputStream.open(Native Method)
      15:59:12 at java.io.FileInputStream.<init>(FileInputStream.java:138)
      15:59:12 at java.io.FileReader.<init>(FileReader.java:72)
      15:59:12 at hudson.plugins.android_emulator.util.Utils.parseConfigFile(Utils.java:478)
      15:59:12 at hudson.plugins.android_emulator.SdkInstaller$3.call(SdkInstaller.java:365)
      15:59:12 at hudson.plugins.android_emulator.SdkInstaller$3.call(SdkInstaller.java:362)
      15:59:12 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      15:59:12 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      15:59:12 at hudson.remoting.Request$2.run(Request.java:326)
      15:59:12 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      15:59:12 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      15:59:12 at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      15:59:12 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      15:59:12 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      15:59:12 at java.lang.Thread.run(Thread.java:724)

      When a symbolic link is created in the workspace dir to ~/.android/avd or the .ini and .avd files are copied to the workspace, the AVD is invalid (error: missing kernel file).

      16:16:42 $ /Users/lkung/tools/android-sdk/tools/android list target
      16:16:43 [android] Using Android SDK: /Users/lkung/tools/android-sdk
      16:16:43 $ /Users/lkung/tools/android-sdk/platform-tools/adb start-server
      16:16:43 [android] Starting Android emulator
      16:16:43 [android] Erasing existing emulator data...
      16:16:43 $ /Users/lkung/tools/android-sdk/tools/emulator -no-boot-anim -ports 59381,59382 -avd Image -no-snapshot-load -no-snapshot-save -wipe-data -http-proxy 10.15.11.60
      16:16:43 emulator: ERROR: This AVD's configuration is missing a kernel file!!
      16:16:46 * daemon not running. starting it now on port 59383 *
      16:16:46 * daemon started successfully *
      16:17:48 [android] Emulator did not appear to start; giving up
      16:17:48 $ /Users/lkung/tools/android-sdk/platform-tools/adb disconnect localhost:59382
      16:17:48 [android] Stopping Android emulator
      16:17:48 $ /Users/lkung/tools/android-sdk/platform-tools/adb kill-server

      I tried setting $ANDROID_SDK_HOME to $HOME and $ANDROID_SDK_ROOT to $ANDROID_HOME using the EnvInject plugin, but neither of those worked.

      Edit: The emulator image runs fine when launched locally ("emulator @Image").

          [JENKINS-18919] Android Emulator Plugin looks in workspace to find existing AVD

          Have you perhaps enabled the "Keep emulators in the job workspace, in the .android subdirectory, to isolate them as much as possible" option in the Jenkins system config?

          Christopher Orr added a comment - Have you perhaps enabled the "Keep emulators in the job workspace, in the .android subdirectory, to isolate them as much as possible" option in the Jenkins system config?

          Ling-Yi Kung added a comment -

          I have, but I wouldn't expect it to affect existing AVDs, which I assume are global (but maybe this isn't the right way to think about it). Even when I created a symlink to the ~/.android folder in my workspace, it didn't launch the emulator (missing kernel file error). I'm not sure why this happens, since I can launch it fine through command line or the AVD interface.

          Ling-Yi Kung added a comment - I have, but I wouldn't expect it to affect existing AVDs, which I assume are global (but maybe this isn't the right way to think about it). Even when I created a symlink to the ~/.android folder in my workspace, it didn't launch the emulator (missing kernel file error). I'm not sure why this happens, since I can launch it fine through command line or the AVD interface.

          Code changed in jenkins
          User: Christopher Orr
          Path:
          src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java
          http://jenkins-ci.org/commit/android-emulator-plugin/92d9c035fff83dac0f5d20a12558aa16ee0d3408
          Log:
          [FIXED JENKINS-18919] Support named AVDs while 'keep in workspace' is enabled.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christopher Orr Path: src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java http://jenkins-ci.org/commit/android-emulator-plugin/92d9c035fff83dac0f5d20a12558aa16ee0d3408 Log: [FIXED JENKINS-18919] Support named AVDs while 'keep in workspace' is enabled.

          Version 2.11 of the plugin has been released, which fixes this issue.

          Christopher Orr added a comment - Version 2.11 of the plugin has been released, which fixes this issue.

            orrc Christopher Orr
            linguinee Ling-Yi Kung
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: