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

On-the-fly AVD creation does not work if hudson run's as "Local System" account

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Won't Fix
    • Labels:
      None
    • Environment:
      Hudson 1.374 running on Windows 2003; Android Emulator Plugin 1.3.1; JDK 1.6.0_11-b03; Android SDK r06 with all components installed
    • Similar Issues:

      Description

      Choose "Run emulator with properties" and set

      • Android OS version: 2.1
      • Density: 160
      • Resolution: 480x800
      • SD card: 16M
        Uncheck "Reset emulator state at start-up" and "Show emulator window"
        Delay: 0
        During build the following error message is displayed:
        [android] Using Android SDK: d:\tools\android-sdk-windows
        [android] Starting Android emulator
        $ d:\tools\android-sdk-windows/tools/emulator.exe -ports 2331,2332 -no-boot-anim -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-7 -no-window
        emulator: ERROR: unknown virtual device name: 'hudson_en-US_160_WVGA_android-7'
        emulator: could not find virtual device named 'hudson_en-US_160_WVGA_android-7'
        [android] Emulator did not appear to start; giving up
        [android] Stopping Android emulator

        Attachments

          Activity

          Hide
          orrc Christopher Orr added a comment -

          That's quite the regression, sorry.

          Could you please post the output of these commands on the "Script Console"?

          println System.getenv("ANDROID_SDK_HOME")
          println System.getenv("ANDROID_SDK_ROOT")
          println System.getenv("ANDROID_HOME")
          println System.getenv("USERPROFILE")
          println System.getenv("HUDSON_HOME")
          println System.getenv("USERNAME")
          println System.getProperty("user.home")

          Also, are you running a Hudson as a service on Windows, or via a different means?

          Show
          orrc Christopher Orr added a comment - That's quite the regression, sorry. Could you please post the output of these commands on the "Script Console"? println System.getenv("ANDROID_SDK_HOME") println System.getenv("ANDROID_SDK_ROOT") println System.getenv("ANDROID_HOME") println System.getenv("USERPROFILE") println System.getenv("HUDSON_HOME") println System.getenv("USERNAME") println System.getProperty("user.home") Also, are you running a Hudson as a service on Windows, or via a different means?
          Hide
          alex1973 alex1973 added a comment -

          Here's the output:
          null
          null
          D:\tools\android-sdk-windows
          C:\Documents and Settings\Default User
          d:\hudson
          null
          C:\Documents and Settings\Default User

          Hudson runs as a service.

          Show
          alex1973 alex1973 added a comment - Here's the output: null null D:\tools\android-sdk-windows C:\Documents and Settings\Default User d:\hudson null C:\Documents and Settings\Default User Hudson runs as a service.
          Hide
          orrc Christopher Orr added a comment -

          Thanks for the info.

          I notice that the log output doesn't claim that it created a new AVD, meaning the plugin found an existing one.

          Do you know where the AVD is located, and does this differ from where AVDs are created if you run 'android create avd' manually as the Hudson user?

          Show
          orrc Christopher Orr added a comment - Thanks for the info. I notice that the log output doesn't claim that it created a new AVD, meaning the plugin found an existing one. Do you know where the AVD is located, and does this differ from where AVDs are created if you run 'android create avd' manually as the Hudson user?
          Hide
          alex1973 alex1973 added a comment -

          Actually, that was the output from the third trial. I have just checked the avd folder to see whether the AVD was created. And, it was:

          Directory of C:\Documents and Settings\Default User\.android\avd
          09/03/2010 04:51 PM <DIR> .
          09/03/2010 04:51 PM <DIR> ..
          09/03/2010 04:51 PM <DIR> hudson_en-US_160_WVGA_android-7.avd
          09/03/2010 04:51 PM 110 hudson_en-US_160_WVGA_android-7.ini
          1 File(s) 110 bytes

          Here's the output from the first run:
          [android] Using Android SDK: d:\tools\android-sdk-windows
          [android] Creating Android AVD at C:\Documents and Settings\Default User\.android\avd\hudson_en-US_160_WVGA_android-7.avd
          [android] Starting Android emulator
          $ d:\tools\android-sdk-windows/tools/emulator.exe -ports 2711,2712 -no-boot-anim -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-7
          emulator: ERROR: unknown virtual device name: 'hudson_en-US_160_WVGA_android-7'
          emulator: could not find virtual device named 'hudson_en-US_160_WVGA_android-7'
          [android] Emulator did not appear to start; giving up
          [android] Stopping Android emulator

          Show
          alex1973 alex1973 added a comment - Actually, that was the output from the third trial. I have just checked the avd folder to see whether the AVD was created. And, it was: Directory of C:\Documents and Settings\Default User\.android\avd 09/03/2010 04:51 PM <DIR> . 09/03/2010 04:51 PM <DIR> .. 09/03/2010 04:51 PM <DIR> hudson_en-US_160_WVGA_android-7.avd 09/03/2010 04:51 PM 110 hudson_en-US_160_WVGA_android-7.ini 1 File(s) 110 bytes Here's the output from the first run: [android] Using Android SDK: d:\tools\android-sdk-windows [android] Creating Android AVD at C:\Documents and Settings\Default User\.android\avd\hudson_en-US_160_WVGA_android-7.avd [android] Starting Android emulator $ d:\tools\android-sdk-windows/tools/emulator.exe -ports 2711,2712 -no-boot-anim -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-7 emulator: ERROR: unknown virtual device name: 'hudson_en-US_160_WVGA_android-7' emulator: could not find virtual device named 'hudson_en-US_160_WVGA_android-7' [android] Emulator did not appear to start; giving up [android] Stopping Android emulator
          Hide
          alex1973 alex1973 added a comment -

          By default, Windows services run using a special user "Local System".
          Now, I have created a special user in order to check what you have asked. If Hudson runs with this user everything seems to be ok.

          Show
          alex1973 alex1973 added a comment - By default, Windows services run using a special user "Local System". Now, I have created a special user in order to check what you have asked. If Hudson runs with this user everything seems to be ok.
          Hide
          orrc Christopher Orr added a comment -

          Ok, thanks for confirming this. I did have a couple of other people report similar issues to me in the past. I hadn't seen it myself on Windows, as I use a "hudson" role account to run the service.

          As far as I can determine, this is a bug on Android's part – the Java-based `android` tool which creates AVDs in a certain directory (determined by environment variables and Java properties), whereas the C-based `emulator` seems to rely on a Win32 API call to retrieve a known user profile directory.

          I imagine that there is a subtle difference between the two when run as a service.

          Someone can feel free to investigate further in the AOSP and submit a patch.

          Meanwhile, I have added this as a known issue on the wiki.

          Show
          orrc Christopher Orr added a comment - Ok, thanks for confirming this. I did have a couple of other people report similar issues to me in the past. I hadn't seen it myself on Windows, as I use a "hudson" role account to run the service. As far as I can determine, this is a bug on Android's part – the Java-based `android` tool which creates AVDs in a certain directory (determined by environment variables and Java properties), whereas the C-based `emulator` seems to rely on a Win32 API call to retrieve a known user profile directory. I imagine that there is a subtle difference between the two when run as a service. Someone can feel free to investigate further in the AOSP and submit a patch. Meanwhile, I have added this as a known issue on the wiki.
          Hide
          orrc Christopher Orr added a comment -

          Closing this as "won't fix" as I don't believe there's anything that can be done in the plugin just now.

          Show
          orrc Christopher Orr added a comment - Closing this as "won't fix" as I don't believe there's anything that can be done in the plugin just now.

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              alex1973 alex1973
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: