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

No way to replace variables to use my ANDROID_HOME

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I´m trying to make jenkins use all my enviromnent (including .android/avd and sdk).

      So I tryed adding variables to my node:

      Use https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
      and this variables under `Prepare an environment for the run` for my task:
      ```
      ANDROID_AVD_HOME=/Users/danielgomez22/.android/avd/
      ANDROID_HOME=/Users/danielgomez22/Library/Android/sdk
      ANDROID_SDK_HOME=/Users/danielgomez22/
      JENKINS_ANDROID_HOME=/Users/danielgomez22/Library/Android/sdk
      PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
      ```

      But jenkins always try to get avd emulators from /Users/Shared/Jenkins/.android/avd/.
      And then when I try to run a created emulator it returns:
      ```
      FATAL: /Users/Shared/Jenkins/.android/avd/Nexus_5_API_22_Google_Apis.ini (No such file or directory)
      java.io.FileNotFoundException: /Users/Shared/Jenkins/.android/avd/Nexus_5_API_22_Google_Apis.ini (No such file or directory)
      at java.io.FileInputStream.open0(Native Method)
      at java.io.FileInputStream.open(FileInputStream.java:195)
      at java.io.FileInputStream.<init>(FileInputStream.java:138)
      at java.io.FileReader.<init>(FileReader.java:72)
      at hudson.plugins.android_emulator.util.Utils.parseConfigFile(Utils.java:449)
      at hudson.plugins.android_emulator.SdkInstaller$3.call(SdkInstaller.java:414)
      at hudson.plugins.android_emulator.SdkInstaller$3.call(SdkInstaller.java:411)
      at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
      at hudson.plugins.android_emulator.SdkInstaller.getPlatformFromExistingEmulator(SdkInstaller.java:411)
      at hudson.plugins.android_emulator.SdkInstaller.getPlatformForEmulator(SdkInstaller.java:395)
      at hudson.plugins.android_emulator.SdkInstaller.installDependencies(SdkInstaller.java:236)
      at hudson.plugins.android_emulator.AndroidEmulator.setUp(AndroidEmulator.java:256)
      at hudson.model.Build$BuildExecution.doRun(Build.java:156)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
      at hudson.model.Run.execute(Run.java:1741)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:381)
      Finished: FAILURE
      ```

      And when I try to create a new one:
      ```
      $ /Users/Shared/Jenkins/Home/tools/android-sdk/tools/android list target
      [android] Using Android SDK: /Users/Shared/Jenkins/Home/tools/android-sdk
      [android] Waiting 20 seconds before starting emulator...
      $ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server

      • daemon not running. starting it now on port 6659 *
      • daemon started successfully *
        $ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server
        [android] Starting Android emulator
        [android] Erasing existing emulator data...
        $ /Users/Shared/Jenkins/Home/tools/android-sdk/tools/emulator -ports 6657,6658 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_320_1080x1920_Google_Inc._Google_APIs_22_google_apis-x86 -no-snapshot-load -no-snapshot-save -wipe-data -no-window -no-audio -gpu off -no-boot-anim
        PANIC: ANDROID_AVD_HOME is defined but could not find hudson_en-US_320_1080x1920_Google_Inc._Google_APIs_22_google_apis-x86.ini file in $ANDROID_AVD_HOME
        (Note: avd is searched in the order of $ANDROID_AVD_HOME,$ANDROID_SDK_HOME/.android/avd and $HOME/.android/avd)
        [android] Emulator did not appear to start; giving up
        $ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb disconnect localhost:6658
        [android] Stopping Android emulator
        $ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb kill-server
        Finished: NOT_BUILT
        ```

        Attachments

          Activity

          Hide
          orrc Christopher Orr added a comment -

          You should be able to set the SDK path in the global Jenkins preferences, under the Android section.

          For the emulators, it seems like it would be easiest to make /Users/Shared/Jenkins/.android a symlink to /Users/danielgomez22/.android with the appropriate permissions.

          Show
          orrc Christopher Orr added a comment - You should be able to set the SDK path in the global Jenkins preferences, under the Android section. For the emulators, it seems like it would be easiest to make /Users/Shared/Jenkins/.android a symlink to /Users/danielgomez22/.android with the appropriate permissions.
          Hide
          danielgomez22 Daniel Gomez added a comment -

          But why it uses this path even when I set all of those variables everywhere?

          /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server

          Show
          danielgomez22 Daniel Gomez added a comment - But why it uses this path even when I set all of those variables everywhere? /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              danielgomez22 Daniel Gomez
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: