【发布时间】:2015-07-07 09:00:47
【问题描述】:
我正在尝试为 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,据我了解,我正在为测试创建并启动一个模拟器,就像 documentation 所说的那样。
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
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
# - addon-google_apis-google-19
# - add-on
# - extra
# Specify at least one system image,
# if you need to run emulator(s) during your tests
- sys-img-armeabi-v7a-android-22
# - sys-img-x86-android-17
licenses:
- 'android-sdk-license-.+'
# Emulator Management: Create, Start and Wait
before_script:
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
你能告诉我我做错了什么以及如何解决它吗?
【问题讨论】:
-
让我们暂时忘记设备仿真。让我们在真机上试一试。您真的可以确认操作系统可以识别真实设备吗?您可以通过在提升的终端/cmd 提示符中执行
adb devices来做到这一点。如果您看到一些带有数字的长字符串,我们可以解决一个潜在问题。 -
这是由 Travis 主持的。我无法在那里连接设备或执行 shell。我所能做的就是将正确的命令放在 .tavis.yml 文件中,并相信它会启动模拟器。不幸的是,我什至没有收到日志消息。
标签: android continuous-integration travis-ci