我在 GitHub 上得到了一个使用 Travis-ci 进行持续集成的 Android 项目。
Builds currently fail并且我需要显示模拟器的 logcat 以查找有关自动构建过程中出现的问题的更多详细信息。
我试着同时添加:
after_failure:
- adb logcat
after_script:
- adb logcat
但是这两个命令都没有执行。
也许这是由于 travis-ci java 项目构建在执行真正的脚本之前执行了一个 mvn install
命令,而这两个命令都没有执行……我真的被卡住了。任何帮助将不胜感激。
最佳答案
我想你已经不需要它了,但我会尽力回答这个问题。
您需要添加 --all
标志,否则这些包将不可用。
Google 弃用了 -p --obsolete
标志,只有建议的(较新的)包在没有 -a --all
标志的情况下可用。
参见 missing build-tools - line 56
echo "y" | android update sdk --filter platform-tools,build-tools-17.0.0,android-16,extra-android-support,$ANDROID_SDKS --no-ui --force > /dev/null
Error: Missing platform-tools
Error: Missing platform-tools
Error: Ignoring unknown package filter 'build-tools-17.0.0'
当前最新的平台工具建议总是不带--all
标志但是:
$ ./android update sdk -u -t build-tools-17.0.0
Error: Ignoring unknown package filter 'build-tools-17.0.0'
Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
$ ./android update sdk -a -u -t build-tools-17.0.0
Packages selected for install:
- Android SDK Build-tools, revision 17
可能缺少构建工具和 android-17 平台是 Properties file not found. 的原因
我看到了here travis-lint 的解决方法,我不使用它。
这是我目前用于日志的工作,需要改进但有效,-e
用于模拟器。您需要自定义您的 MOD_NAME
。
# adb -e: direct an adb command to the only running emulator. Return an error if more than one. before_script: # - echo 'LOGCAT' # Check logcat debug output: http://developer.android.com/tools/help/logcat.html # Check debugging log: http://developer.android.com/tools/debugging/debugging-log.html # Comment the lines belows to debug output and redirect it to a file. Custom tags for your app. - adb -e logcat *:W | tee logcat.log > /dev/null 2>&1 & after_failure: # - echo 'FAILURE' # Check apt configuration: http://docs.travis-ci.com/user/ci-environment/#apt-configuration # Comment out the lines below to show log about tests with app name customized on exports section. - sudo apt-get install -qq lynx - export MOD_NAME=yourappmodulename - export LOG_DIR=${TRAVIS_BUILD_DIR}/${MOD_NAME}/build/outputs/reports/androidTests/connected/ - lynx --dump ${LOG_DIR}com.android.builder.testing.ConnectedDevice.html > myConnectedDevice.log - lynx --dump ${LOG_DIR}com.android.builder.testing.html > myTesting.log - for file in *.log; do echo "$file"; echo "====================="; cat "$file"; done || true after_script: # Uncomment the line below to kill adb and show logcat output. - echo " LOGCAT "; echo "========"; cat logcat.log; pkill -KILL -f adb
我正在寻找 lynx
的预安装替代方案,因为 sudo
在使用基于容器的基础架构时不可用,而 cat
确实可以对于连接文件,如果有人知道改进它,谢谢。
关于android - 如何在travis-ci上显示android模拟器的logcat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15645602/