5

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.

Ravi Bhatt
  • 1,930
  • 1
  • 14
  • 27
  • Hi, Try creating another AVD – Nadir Belhaj Sep 12 '14 at 05:40
  • @NadirB from AVD manager or by using Jenkins? If you are suggesting using Jenkins, then it would be the alternative not the solution. – Ravi Bhatt Sep 12 '14 at 05:55
  • did you try to search by hand the emulator does it exist within that path ? – Nadir Belhaj Sep 12 '14 at 05:59
  • There is no any emulator in that path and I don't want to use that path too. I want to set the path of my choice but I am not able to find the option for it. – Ravi Bhatt Sep 12 '14 at 06:01
  • ok check this link https://www.youtube.com/watch?v=zm6ntUt-vqY – Nadir Belhaj Sep 12 '14 at 06:02
  • Are you using Master-Slave configuration or is it a standalone Jenkins? – Technext Sep 12 '14 at 06:22
  • @Technext I just have installed Jenkins and have installed Android emulator plugin. Moreover, I have set the required path of JDK, ANT and Android SDK. Do I need to configure something more? My project is on PC only so I have set workspace path too for that. – Ravi Bhatt Sep 12 '14 at 06:26
  • Can you run the command from command line? – Technext Sep 12 '14 at 06:33
  • What command? By command line, you mean Jenkins script console or windows command prompt? – Ravi Bhatt Sep 12 '14 at 06:35
  • Command to start Android emulator from Win command prompt. – Technext Sep 12 '14 at 06:37
  • Yes I am able to do that. What my actual problem is Jenkins **automatically** try to find avd in 'C:\Windows\system32\config\systemprofile\.android\avd\', while avds are in "C:\Users\user.name\.android\avd" folder. So I want to change that Jenkins default path to my avd path. – Ravi Bhatt Sep 12 '14 at 06:40
  • The PATH that Jenkins is searching for is the `SYSTEM` profile path because Jenkins must be running as SYSTEM user. This you can verify when you will go to `Log On` tab as described in my answer. – Technext Sep 12 '14 at 06:45

1 Answers1

7

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

Technext
  • 7,887
  • 9
  • 48
  • 76
  • I have followed your answer and now its not giving that windows path error. So my path issue is resolved. Though I am not able to run existing emulator but I will try for that. As it has solved my path and user problem, I am accepting this answer. :) – Ravi Bhatt Sep 12 '14 at 07:26