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

1

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.

Mutz answered 12/9, 2014 at 5:6 Comment(12)
Hi, Try creating another AVDNovikoff
@NadirB from AVD manager or by using Jenkins? If you are suggesting using Jenkins, then it would be the alternative not the solution.Mutz
did you try to search by hand the emulator does it exist within that path ?Novikoff
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.Mutz
ok check this link youtube.com/watch?v=zm6ntUt-vqYNovikoff
Are you using Master-Slave configuration or is it a standalone Jenkins?Lonilonier
@Lonilonier 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.Mutz
Can you run the command from command line?Lonilonier
What command? By command line, you mean Jenkins script console or windows command prompt?Mutz
Command to start Android emulator from Win command prompt.Lonilonier
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.Mutz
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.Lonilonier
L
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

Lonilonier answered 12/9, 2014 at 6:42 Comment(1)
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. :)Mutz

© 2022 - 2024 — McMap. All rights reserved.