Can't configure travis to work on android project

我的未来我决定 提交于 2019-12-05 11:27:22
albodelu

Solution:

Delete -no-boot-anim option to wait for emulator ready and increase timeout to 10 minutes.


First issue:

Replace

  - emulator -avd test -no-skin -no-audio -no-window -gpu off -no-boot-anim &

By

  - emulator -avd test -no-skin -no-audio -no-window -gpu off &

Deleting -no-boot-anim option, android-wait-for-emulator script depends on boot animation to detect when the emulator is ready as I explain here.

I forked your project to confirm this on a develop branch and the Travis-CI build passed but...


Second issue:

Later I recreated the change using the master branch and the build failed...

Caused by: com.android.ddmlib.ShellCommandUnresponsiveException

You already fixed this version of the issue very well explained by Sean Barbeau:

# install timeout in minutes (2 minutes by default)
- ADB_INSTALL_TIMEOUT=8

and you also fixed another timeout issue explained here and here that needs more time, see:

Android Gradle Plugin had a hard coded timeout value that was too low.

Google fixed it (version 2.0.0-beta3):

https://code.google.com/p/android/issues/detail?id=189764

So what do we put in build.gradle to set this timeout value?

Currently it's all attached to android.adbOptions.timeOutInMs.

Sample: Google project Increasing ADB timeout and adding Travis-ci support. It works!

// This enables long timeouts required on slow environments, e.g. Travis
adbOptions {
    timeOutInMs 10 * 60 * 1000  // Set the timeout to 10 minutes
    installOptions "-d","-t"
}

I increased the timeout from 1 to 10 minutes like Mark McDonald did, and the build passed:

Try few things

  • Make sure that Emulator is launched / Device is connected
  • Restart adb with $ adb kill-server
  • Check that emulator setting "Use Host GPU" is enabled
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!