Search code examples
androidjenkinsandroid-emulator-plugin

How to set path in Jenkins for directory having Android AVD?


When I try to build my android workspace using Jenkins Build Now option, It will show the error like

[android] Cannot start Android emulator: Could not start AVD 'Nexus_4', as it could 
not be found at 'C:\Windows\system32\config\systemprofile\.android\avd\Nexus_4.avd'
Recording test results
Finished: FAILURE

By default, directory for android avd is /users/user.name/.android. How can I provide this avd path to Jenkins? It always try to search avd in above given Windows location automatically.

Note : I am using Windows-7 OS.


Solution

  • If your command runs fine on Win command prompt as user 'X', then you should run Jenkins with the same user.

    This can be achieved by performing following steps:
    1. Run > services.msc (Enter)
    2. Select Jenkins service. Right-click and select Properties
    3. Click on Log On tab
    4. Select user 'X' and provide credentials
    5. Restart Jenkins

    In your case, the user 'X' seems to be user.name since the path to AVD as mentioned by you is /users/user.name/.android

    enter image description here