1

我在GitHub上获得了一个使用Travis-ci进行持续集成的Android项目。如何在travis-ci上显示android模拟器的logcat?

Builds currently fail我需要显示模拟器的logcat以查找有关在自动构建期间发生的问题的更多详细信息。

我尝试添加两个:

after_failure: 
    - adb logcat 

after_script: 
    - adb logcat 

但是这两个命令永远不会被执行。

也许这是由于travis-ci java项目构建的执行mvn install命令之前,真正的脚本执行,并没有得到执行两个命令......我真的卡住了。任何帮助,将不胜感激。

回答

0

一些额外的尝试后,我可以通过任何一个得到的logcat:

#build 25 
#run all tests 
    - mvn clean install -DskipTests=false 
#build 26 
    - adb logcat & 

在before_install特拉维斯阶段。

我通过mvn install -DskipTests = Travis的true。尽管如此,我无法通过任何方式在常规构建过程中获得logcat。任何想法 ?

1

我想你已经不需要它了,但我会尽量回答这个问题。

您需要添加--all标志,否则这些软件包不可用。

谷歌不赞成-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是真正为连接文件,如果有人知道,以改善它,谢谢。

相关问题