[英]How to display the logcat of android emulator on travis-ci?
I got an Android project on GitHub that uses Travis-ci for continuous integration. 我在GitHub上有一个Android项目,该项目使用Travis-ci进行持续集成。
Builds currently fail and I need to display the logcat of the emulator to find more details about the problem that occurs during the automated build. 当前构建失败 ,我需要显示仿真器的日志,以查找有关自动构建过程中出现的问题的更多详细信息。
I tried to add both : 我试图将两者都添加:
after_failure:
- adb logcat
after_script:
- adb logcat
But both commands never get executed. 但是两个命令都不会执行。
Maybe this is due to travis-ci java project builds that execute a mvn install
command before the real script is executed and both commands don't get executed... I am really stuck. 也许这是由于travis-ci java项目构建会在执行真正的脚本之前执行mvn install
命令,而两个命令均未执行...我真的很困惑。 Any help would be appreciated. 任何帮助,将不胜感激。
I think you already dont need it but I'll try to answer the question. 我认为您已经不需要它了,但我会尽力回答这个问题。
You need add the --all
flag otherwise these packages were not available. 您需要添加--all
标志,否则这些软件包将不可用。
Google deprecated the -p --obsolete
flag and only suggested (newer) packages are available without -a --all
flag. Google弃用了-p --obsolete
标志,只有不带-a --all
标志的建议(较新)软件包可用。
See missing build-tools - line 56 查看缺少的构建工具-第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'
Currently latest platform-tools are suggested always without --all
flag but: 目前建议使用的最新平台工具始终不带--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
Probably the lack of build-tools and android-17 platform are the cause of Properties file not found. 可能缺少构建工具和android-17平台是找不到Properties文件的原因。
And I saw here a work around for travis-lint, I don't use it. 我在这里看到travis-lint的解决方法,我没有使用它。
This is the current work around I use for logs, needs be improved but works, -e
for emulator. 这是我目前用于日志的解决方法,需要改进,但可以使用-e
进行模拟器。 You need custom your MOD_NAME
. 您需要自定义您的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
I'm looking for a pre-installed alternative to lynx
because sudo
is not available using container-based infrastructure and cat
is really for concatenate files, if anyone knows to improve it, thanks. 我正在寻找lynx
的预装替代品,因为sudo
在基于容器的基础架构中不可用,而cat
实际上是用于连接文件的,如果有人知道可以改进的话,谢谢。
After some additional attempts, I can get logcat via either one : 经过一些额外的尝试,我可以通过以下任何一种方式获取logcat:
#build 25
#run all tests
- mvn clean install -DskipTests=false
#build 26
- adb logcat &
in before_install travis phase. 在before_install travis阶段。
I by pass the mvn install -DskipTests=true of Travis. 我通过了Travis的mvn install -DskipTests = true。 Nevertheless I couldn't get any way to get the logcat during a regular build. 但是,在常规构建期间,我无法获得任何日志记录。 Any idea ? 任何想法 ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.