我正在尝试为Android设置Travis.到目前为止,运行构建似乎工作,但是当涉及到测试时,它抱怨"没有连接的设备!"
:app:connectedAndroidTestDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedAndroidTestDebug'.
> com.android.builder.testing.api.DeviceException: java.lang.RuntimeException: 
    No connected devices!
这是我的.travis.yml,根据我的理解,我正在为测试创建和启动模拟器,就像文档所说的那样.
language: android
android:
  components:
    # Uncomment the lines below if you want to
    # use the latest revision of Android SDK Tools
    # - platform-tools
    # - tools
    # The BuildTools version used by your project
    - build-tools-22.0.1
    # The SDK version used to compile your project
    - android-22
    # Additional components
    - …我似乎无法从命令行获取Gradle命令来使用API 23 Google API模拟器图像(Google APIs ARM (armeabi-v7a)) - 我总是得到一个com.android.ddmlib.ShellCommandUnresponsiveException.
重现步骤:
Google APIs ARM (armeabi-v7a)gradlew installDebug命令行你会看到的:
:demo:assembleDebug:demo:installDebug FAILED
FAILURE:构建因异常而失败.
- 什么地方出了错:
任务':demo:installDebug'的执行失败.com.android.builder.testing.api.DeviceException:com.android.ddmlib.ShellCommandUnresponsiveException
如果你跑,gradlew connectedCheck你会看到类似的错误:
- 出了什么问题:任务执行失败':library:connectedDebugAndroidTest'.com.android.builder.testing.api.TestException:com.android.builder.testing.api.DeviceException:com.android.ddmlib.ShellCommandUnresponsiveException
我可以安装/运行Android Studio(1.4)中的项目和测试,没有任何问题.
从命令行,Gradle命令似乎在API 21 Google API仿真器映像上正常运行.
以下是Travis for API 23 Google API模拟器映像的示例失败:
https://travis-ci.org/barbeau/android-maps-utils/builds/83233500
...以及使用API 21 Google API仿真器映像时的成功构建示例:
https://travis-ci.org/barbeau/android-maps-utils/builds/83234555
这两个版本之间的唯一区别是Google API模拟器API级别为23对21:
https://github.com/barbeau/android-maps-utils/commit/a5eecd7e7a4fc899ecd5eaeae6826414fefeae70
编辑
我在这里就这个问题打开了一个AOSP问题:
android android-emulator android-studio android-gradle-plugin
I'm trying to get travis-ci to work with my android application. If I only execute assembleDebug it works fine. But I want to run tests too and generate code coverage. This is the config I have right now:
language: android
android:
  components:
    # Uncomment the lines below if you want to
    # use the latest revision of Android SDK Tools
    - platform-tools
    - tools
    # The BuildTools version used by your project
    - build-tools-23.0.1
    # The SDK version used to …我发现了特拉维斯CI的几个问题,我一直在解决它们,但最后一个我不能解决它们.
我遇到了常见的错误
com.android.ddmlib.InstallException: Failed to establish session
这是我的travis文件:
language: android
before_install:
 - chmod +x gradlew
android:
  components:
    # Uncomment the lines below if you want to
    # use the latest revision of Android SDK Tools
    # - platform-tools
    # - tools
    # The BuildTools version used by your project
    - tools
    - build-tools-23.0.3
    # Additional components
    - extra-google-m2repository
    - extra-android-m2repository
    # The SDK version used to compile your project
    - android-23
    # Specify at least one system image,
    # if …