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

Invalid AVD Path / AVD not created

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Incomplete
    • Labels:
      None
    • Environment:
      Jenkins 2.1
      Android SDK is configured on slave agent, Ubuntu Server LTS 14.04
    • Similar Issues:

      Description

      11:46:06 $ /home/jenkins/android/tools/android list target
      11:46:07 [android] Using Android SDK: /home/jenkins/android
      11:46:07 [android] Creating Android AVD: /tmp/.android/avd/hudson_pl-PL_320_768x1280_Google_Inc._Google_APIs_17_armeabi-v7a_-jars-test.avd
      11:46:07 [android] /home/jenkins/android/tools/android create avd -f -a -c 64M -s 768x1280 -n hudson_pl-PL_320_768x1280_Google_Inc._Google_APIs_17_armeabi-v7a_-jars-test -t "Google Inc.:Google APIs:17" --abi armeabi-v7a
      11:46:08 [android] Could not create Android emulator: Failed to parse AVD config file
      

      I checked source code of plugin, and the only place where '/tmp' directory is being set is at
      https://github.com/jenkinsci/android-emulator-plugin/blob/master/src/main/java/hudson/plugins/android_emulator/util/Utils.java#L284

      I investigated this further by creating simple jar, which was then ran in 'execute shell' build step..

      public class Main {
          public static void main(String[] args) {
              System.out.println("home: " + System.getenv("HOME"));
              System.out.println("username: " + System.getProperty("user.name"));
          }
      }
      

      and here is the output:

      12:39:13 home: null
      12:39:13 username: jenkins
      

      When I execute this jar directly from shell over ssh it works properly.

      I have no clue why is it working that way, but have you considered using EnvVars class? It stores all environment variables available on machine, including those injected by plugins / slaves.
      http://javadoc.jenkins-ci.org/hudson/EnvVars.html

        Attachments

          Activity

          Hide
          sebokopter Sebastian Heil added a comment -

          I have the same problem on my jenkins node.
          Could this issue be caused by the fact that we're running the android emulator plugin on a node?

          Show
          sebokopter Sebastian Heil added a comment - I have the same problem on my jenkins node. Could this issue be caused by the fact that we're running the android emulator plugin on a node?
          Hide
          adamkobusifm Adam Kobus added a comment -

          I did quite many fixes over the time to this plugin Sebastian Heil. You can find them at:
          https://github.com/inFullMobile/android-emulator-plugin/tree/ST-177

          I'm not eager to create pull request on main repo, since plugin itself seems to be abandoned by creator.

          Diff with original repo can be found at:
          https://github.com/jenkinsci/android-emulator-plugin/pull/64/files

          As for plugin configuration in jobs:

          • use armeabi-v7a in target.
          • use android SDK in format android-<sdk version>, i.e. 'android-19'
          • use SDK card 256M +

          Snapshots are not working. I had to abandon classic emulator engine due to bugs.

          I'm also disabling animations on the emulator via custom script, can't publish it right now though.
          Additionally, before running tests, execute following command:

          adb shell setprop dalvik.vm.usejit false

          This will prevent tests crashes caused by bugs in JIT implementation on emulator images.

          In the end, I also execute post build script, just to be sure node state is settled after build competes:
          #!/bin/bash +e
          pkill -9 -f "emulator" || true
          pkill -9 -f "adb" || true

          1. why kill emulator? sometimes emulator-crash service is preventing emulator from exiting gracefully
          2. why kill adb? if adb doesn't stop, you can end up with multiple adb servers running at once. Because of that, scripts executed from shell script steps and ones executed by plugin can target different servers leading to unnecessary headaches (had many of them )

          Hope this helps, cheers!

          Show
          adamkobusifm Adam Kobus added a comment - I did quite many fixes over the time to this plugin Sebastian Heil . You can find them at: https://github.com/inFullMobile/android-emulator-plugin/tree/ST-177 I'm not eager to create pull request on main repo, since plugin itself seems to be abandoned by creator. Diff with original repo can be found at: https://github.com/jenkinsci/android-emulator-plugin/pull/64/files As for plugin configuration in jobs: use armeabi-v7a in target. use android SDK in format android-<sdk version>, i.e. 'android-19' use SDK card 256M + Snapshots are not working. I had to abandon classic emulator engine due to bugs. I'm also disabling animations on the emulator via custom script, can't publish it right now though. Additionally, before running tests, execute following command: adb shell setprop dalvik.vm.usejit false This will prevent tests crashes caused by bugs in JIT implementation on emulator images. In the end, I also execute post build script, just to be sure node state is settled after build competes: #!/bin/bash +e pkill -9 -f "emulator" || true pkill -9 -f "adb" || true 1. why kill emulator? sometimes emulator-crash service is preventing emulator from exiting gracefully 2. why kill adb? if adb doesn't stop, you can end up with multiple adb servers running at once. Because of that, scripts executed from shell script steps and ones executed by plugin can target different servers leading to unnecessary headaches (had many of them ) Hope this helps, cheers!
          Hide
          orrc Christopher Orr added a comment -

          I can't really make much sense of this report, but please try the new 3.0 release of the plugin and open a new issue if there are similar problems.

          Show
          orrc Christopher Orr added a comment - I can't really make much sense of this report, but please try the new 3.0 release of the plugin and open a new issue if there are similar problems.

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              adamkobusifm Adam Kobus
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: