Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Emulator plugin not working in Jenkins

When I run test on Jenkins with option create emulator I have this problem:

[android] Could not create Android emulator: Failed to run AVD creation command

When I target existing emulator I have this problem:

FATAL: C:\Windows\system32\config\systemprofile.android\avd\AVD_2.2.ini (The system cannot find the path specified) java.io.FileNotFoundException: C:\Windows\system32\config\systemprofile.android\avd\AVD_2.2.ini (The system cannot find the path specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(Unknown Source) at java.io.FileReader.(Unknown Source) at hudson.plugins.android_emulator.util.Utils.parseConfigFile(Utils.java:436) at hudson.plugins.android_emulator.SdkInstaller$2.call(SdkInstaller.java:331) at hudson.plugins.android_emulator.SdkInstaller$2.call(SdkInstaller.java:328) at hudson.remoting.LocalChannel.call(LocalChannel.java:45) at hudson.plugins.android_emulator.SdkInstaller.getPlatformFromExistingEmulator(SdkInstaller.java:328) at hudson.plugins.android_emulator.SdkInstaller.getPlatformForEmulator(SdkInstaller.java:312) at hudson.plugins.android_emulator.SdkInstaller.installDependencies(SdkInstaller.java:174) at hudson.plugins.android_emulator.AndroidEmulator.setUp(AndroidEmulator.java:247) at hudson.model.Build$BuildExecution.doRun(Build.java:154) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499) at hudson.model.Run.execute(Run.java:1488) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236)

I have this file. When I run manual emulator and tests on jenkins It works.

like image 353
Unii Avatar asked Jan 17 '23 04:01

Unii


1 Answers

The path shown in the second case suggests that you may be running Jenkins as a system service.

In which case, you could try the workaround listed under "Known Issues" on the Android Emulator Plugin wiki page:

Running in a Windows service as "Local System"
New AVDs cannot be generated and run if Jenkins is running as a Windows service, using the "Local System" account (see issue #7355).

Workaround: configure the Jenkins service to "run as" a real user


If that doesn't solve the problem, can you tell us in which directory AVDs are placed when you create them manually? You can find out by running emulator with the -verbose flag. Within the first few lines you should see something like:

emulator: Android virtual device file at: c:\users\foo\.android\avd\emu_4.0.3.ini

like image 113
Christopher Orr Avatar answered Jan 20 '23 14:01

Christopher Orr