当我使用选项创建模拟器在 Jenkins 上运行测试时,我遇到了这个问题:
[android] Could not create Android emulator: Failed to run AVD creation command
当我以现有模拟器为目标时,我遇到了这个问题:
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)
我有这个文件。 当我在 jenkins 上运行手动模拟器和测试时它有效。
最佳答案
第二种情况中显示的路径表明您可能正在将 Jenkins 作为系统服务运行。
在这种情况下,您可以尝试 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
如果那不能解决问题,您能告诉我们您手动创建 AVD 时将它们放在哪个目录中吗?您可以通过使用 -verbose
标志运行 emulator
来找出答案。在前几行中,您应该会看到如下内容:
emulator: Android virtual device file at: c:\users\foo\.android\avd\emu_4.0.3.ini
关于java - Android Emulator 插件在 Jenkins 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11390241/