简体   繁体   中英

TimeoutException when installing apk in android emulator on Jenkins Linux EC2

My employer has Jenkins configured to automatically start up Jenkins slaves on Amazon EC2 when we need to run automated GUI tests for our Android application.

Currently, we are using Android 2.2 as that runs well on our current Jenkins slave set up. The version of the SDK uses API 8 and anything above that times out trying to start up the emulator.

We want to drop support for anything prior to Android 4.0.

I am working on updating our infrastructure to run these automated GUI tests on an emulator using API 15.

We are looking at Ravello, which provides hardware-assisted acceleration via KVM . It is using the x86 system image as well as the android64-x86 binary tool to run.

Currently, an exception is thrown when trying to install the apk. I have Googled it and I do not see anyone experiencing the same error. I used grepcode.com to look at the code that the exception stack trace is printing out; yesterday, I saw that it seemed to have a problem reading from the adb, so I thought that perhaps my SD card was too large and reduced it down to 50M. That worked yesterday and the tests started to run but then hung on one of the tests in the test suite, perhaps 20 tests in a suite of 57 tests.

I then @Suppress ed that test and now I am getting this exception. Removing the @Suppress ion doesn't change anything now: it keeps failing to install.

Has anyone seen this or have suggestions on how I can resolve this issue?

Here is the error log:


[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:internal-pre-integration-test (default-internal-pre-integration-test) on project ravenousity-android-test: Install of /mnt/workspace/workspace/lyndsey-ferguson_DR-1543-update-android-version_android-dynamic-grids/m2-repo/com/ravenousity/ravenousity-android/2.6.1-SNAPSHOT/ravenousity-android-2.6.1-SNAPSHOT.apk failed. InstallException: TimeoutException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:internal-pre-integration-test (default-internal-pre-integration-test) on project ravenousity-android-test: Install of /mnt/workspace/workspace/lyndsey-ferguson_DR-1543-update-android-version_android-dynamic-grids/m2-repo/com/ravenousity/ravenousity-android/2.6.1-SNAPSHOT/ravenousity-android-2.6.1-SNAPSHOT.apk failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Install of /mnt/workspace/workspace/lyndsey-ferguson_DR-1543-update-android-version_android-dynamic-grids/m2-repo/com/ravenousity/ravenousity-android/2.6.1-SNAPSHOT/ravenousity-android-2.6.1-SNAPSHOT.apk failed.
    at com.jayway.maven.plugins.android.AbstractAndroidMojo$1.doWithDevice(AbstractAndroidMojo.java:521)
    at com.jayway.maven.plugins.android.AbstractAndroidMojo.doWithDevices(AbstractAndroidMojo.java:607)
    at com.jayway.maven.plugins.android.AbstractAndroidMojo.deployApk(AbstractAndroidMojo.java:513)
    at com.jayway.maven.plugins.android.AbstractAndroidMojo.deployDependencies(AbstractAndroidMojo.java:541)
    at com.jayway.maven.plugins.android.phase11preintegrationtest.InternalPreIntegrationTestMojo.execute(InternalPreIntegrationTestMojo.java:36)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: com.android.ddmlib.InstallException
    at com.android.ddmlib.Device.installPackage(Device.java:586)
    at com.jayway.maven.plugins.android.AbstractAndroidMojo$1.doWithDevice(AbstractAndroidMojo.java:516)
    ... 25 more
Caused by: com.android.ddmlib.TimeoutException
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:648)
    at com.android.ddmlib.SyncService.doPushFile(SyncService.java:688)
    at com.android.ddmlib.SyncService.pushFile(SyncService.java:375)
    at com.android.ddmlib.Device.syncPackageToDevice(Device.java:607)
    at com.android.ddmlib.Device.installPackage(Device.java:577)
    ... 26 more

My co-worker, JayB, figured it out:

Using the 4.0.0-rc.3 version of the maven-android-plugin, it is possible to configure the adb connection timeout. Using the 3.1.1 version of the plugin, there is no way to do that.

[..snip..we cannot use 4.0.0-rc.3 at this time..]

Instead, I cloned the maven android plugin, created a branch off of the 3.1.1 version, and added one line of code to hard-code the timeout at 60 seconds, installed that updated version of the plugin as version 3.1.1.ravenousity-1 in the local repository, and built using that. In that configuration, the build got through installation of the application and starting of the tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM