java - Android Emulator 插件在 Jenkins 中不起作用

标签 java android testing android-emulator jenkins

当我使用选项创建模拟器在 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/

相关文章:

Java 无符号除法不强制转换为长?

java - 应用程序名称的 JNDI 注入(inject)不起作用,查找可以

android - 如何使用 stripDrawable 和间距自定义 PagerTabStrip

java - 更改数据库后更新 ListView

testing - JMeter JSR223 后处理器获取 Cookie

xcode - 将数据文件从 Xcode 复制到 iPad 沙箱

javascript - 检查缓存的 JS 文件

java - 在生成 .equals() 时,有什么理由更喜欢 getClass() 而不是 instanceof?

java - 使用 BrokeredMessage 消息在 Java 中使用 Azure 队列消息。 getBody() 返回一些头信息,如何摆脱它?

android - 光标应该在绑定(bind) View 中关闭吗?