我已尽力在 gradle 上测试我的 android 项目,但失败了。
你能帮我吗?谢谢。
这是我的项目:
https://github.com/SnowdreamFramework/android-log
我提供了我的错误日志和附件。
[0K$ echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
Android 5.0 is a basic Android platform.
Do you wish to create a custom hardware profile [no]Created AVD 'test' based on Android 5.0, ARM (armeabi-v7a) processor,
with the following hardware config:
hw.cpu.model=cortex-a8
hw.lcd.density=240
hw.ramSize=512
vm.heapSize=48
travis_time:end:0d68df50:start=1416651329874810477,finish=1416651333337412612,duration=3462602135
[0Ktravis_fold:end:before_script.4
[0Ktravis_fold:start:before_script.5
[0Ktravis_time:start:15d80c70
[0K$ emulator -avd test -no-skin -no-audio -no-window &
travis_time:end:15d80c70:start=1416651333347425441,finish=1416651333353869405,duration=6443964
[0Ktravis_fold:end:before_script.5
[0Ktravis_fold:start:before_script.6
[0Ktravis_time:start:01e4ff4d
[0K$ android-wait-for-emulator
Creating filesystem with parameters:
Size: 69206016
Block size: 4096
Blocks per group: 32768
Inodes per group: 4224
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 16896
Block groups: 1
Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
Waiting for emulator to start
Failed to Initialize backend EGL display
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Waiting for emulator to start
Emulator is ready
travis_time:end:01e4ff4d:start=1416651333362333914,finish=1416651367641918931,duration=34279585017
[0Ktravis_fold:end:before_script.6
[0Ktravis_fold:start:before_script.7
[0Ktravis_time:start:1f99871a
[0K$ adb shell input keyevent 82 &
travis_time:end:1f99871a:start=1416651367652665093,finish=1416651367659437822,duration=6772729
[0Ktravis_fold:end:before_script.7
[0Ktravis_time:start:0e5eb826
[0K$ TERM=dumb gradle build connectedCheck
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.3/gradle-0.13.3.pom
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/4.11/proguard-gradle-4.11.pom
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-parent/4.11/proguard-parent-4.11.pom
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint/23.1.3/lint-23.1.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/builder/0.13.3/builder-0.13.3.pom
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-base/4.11/proguard-base-4.11.pom
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint-checks/23.1.3/lint-checks-23.1.3.pom
Download https://repo1.maven.org/maven2/org/eclipse/jdt/core/compiler/ecj/4.2.2/ecj-4.2.2.pom
Download https://repo1.maven.org/maven2/com/android/tools/ddms/ddmlib/23.1.3/ddmlib-23.1.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-model/0.13.3/builder-model-0.13.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/sdk-common/23.1.3/sdk-common-23.1.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/manifest-merger/23.1.3/manifest-merger-23.1.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-test-api/0.13.3/builder-test-api-0.13.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/common/23.1.3/common-23.1.3.pom
Download https://repo1.maven.org/maven2/com/squareup/javawriter/2.5.0/javawriter-2.5.0.pom
Download https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom
Download https://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.pom
Download https://repo1.maven.org/maven2/com/android/tools/sdklib/23.1.3/sdklib-23.1.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint-api/23.1.3/lint-api-23.1.3.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/4.0/asm-analysis-4.0.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-parent/4.0/asm-parent-4.0.pom
Download https://repo1.maven.org/maven2/org/ow2/ow2/1.3/ow2-1.3.pom
Download https://repo1.maven.org/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom
Download https://repo1.maven.org/maven2/kxml2/kxml2/2.3.0/kxml2-2.3.0.pom
Download https://repo1.maven.org/maven2/com/google/guava/guava/15.0/guava-15.0.pom
Download https://repo1.maven.org/maven2/com/google/guava/guava-parent/15.0/guava-parent-15.0.pom
Download https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom
Download https://repo1.maven.org/maven2/com/android/tools/layoutlib/layoutlib-api/23.1.3/layoutlib-api-23.1.3.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1.1/httpcomponents-client-4.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1/httpcomponents-client-4.1.pom
Download https://repo1.maven.org/maven2/com/android/tools/dvlib/23.1.3/dvlib-23.1.3.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/33/commons-parent-33.pom
Download https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm/4.0/asm-4.0.pom
Download https://repo1.maven.org/maven2/com/android/tools/external/lombok/lombok-ast/0.2.2/lombok-ast-0.2.2.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/4.0/asm-tree-4.0.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-core/4.1/httpcomponents-core-4.1.pom
Download https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/5/commons-parent-5.pom
Download https://repo1.maven.org/maven2/org/apache/apache/4/apache-4.pom
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/11/commons-parent-11.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.3/gradle-0.13.3.jar
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/4.11/proguard-gradle-4.11.jar
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint/23.1.3/lint-23.1.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/builder/0.13.3/builder-0.13.3.jar
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-base/4.11/proguard-base-4.11.jar
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint-checks/23.1.3/lint-checks-23.1.3.jar
Download https://repo1.maven.org/maven2/org/eclipse/jdt/core/compiler/ecj/4.2.2/ecj-4.2.2.jar
Download https://repo1.maven.org/maven2/com/android/tools/ddms/ddmlib/23.1.3/ddmlib-23.1.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-model/0.13.3/builder-model-0.13.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/sdk-common/23.1.3/sdk-common-23.1.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/manifest-merger/23.1.3/manifest-merger-23.1.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-test-api/0.13.3/builder-test-api-0.13.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/common/23.1.3/common-23.1.3.jar
Download https://repo1.maven.org/maven2/com/squareup/javawriter/2.5.0/javawriter-2.5.0.jar
Download https://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar
Download https://repo1.maven.org/maven2/com/android/tools/sdklib/23.1.3/sdklib-23.1.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint-api/23.1.3/lint-api-23.1.3.jar
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/4.0/asm-analysis-4.0.jar
Download https://repo1.maven.org/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
Download https://repo1.maven.org/maven2/com/google/guava/guava/15.0/guava-15.0.jar
Download https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar
Download https://repo1.maven.org/maven2/com/android/tools/layoutlib/layoutlib-api/23.1.3/layoutlib-api-23.1.3.jar
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar
Download https://repo1.maven.org/maven2/com/android/tools/dvlib/23.1.3/dvlib-23.1.3.jar
Download https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
Download https://repo1.maven.org/maven2/org/ow2/asm/asm/4.0/asm-4.0.jar
Download https://repo1.maven.org/maven2/com/android/tools/external/lombok/lombok-ast/0.2.2/lombok-ast-0.2.2.jar
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/4.0/asm-tree-4.0.jar
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar
Download https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.jar
Sonatype SNAPSHOT BUILD
GITHUB SNAPSHOT BUILD
Download https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/22/commons-parent-22.pom
Download https://repo1.maven.org/maven2/org/apache/apache/9/apache-9.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar
:lib:androidJavadocsJar
:lib:compileLint
:lib:copyReleaseLint UP-TO-DATE
:lib:mergeReleaseProguardFiles
:lib:preBuild
:lib:preReleaseBuild
:lib:checkReleaseManifest
:lib:prepareReleaseDependencies
:lib:compileReleaseAidl
:lib:compileReleaseRenderscript
:lib:generateReleaseBuildConfig
:lib:generateReleaseAssets UP-TO-DATE
:lib:mergeReleaseAssets
:lib:generateReleaseResValues
:lib:generateReleaseResources
:lib:packageReleaseResources
:lib:processReleaseManifest
:lib:processReleaseResources
:lib:generateReleaseSources
:lib:compileReleaseJava
:lib:processReleaseJavaRes UP-TO-DATE
:lib:packageReleaseJar
:lib:compileReleaseNdk
:lib:packageReleaseJniLibs UP-TO-DATE
:lib:packageReleaseLocalJar UP-TO-DATE
:lib:packageReleaseRenderscript UP-TO-DATE
:lib:bundleRelease
:lib:assembleRelease
:lib:androidReleaseJar
:lib:androidSourcesJar
:lib:copyDebugLint UP-TO-DATE
:lib:mergeDebugProguardFiles
:lib:preDebugBuild
:lib:checkDebugManifest
:lib:prepareDebugDependencies
:lib:compileDebugAidl
:lib:compileDebugRenderscript
:lib:generateDebugBuildConfig
:lib:generateDebugAssets UP-TO-DATE
:lib:mergeDebugAssets
:lib:generateDebugResValues
:lib:generateDebugResources
:lib:packageDebugResources
:lib:processDebugManifest
:lib:processDebugResources
:lib:generateDebugSources
:lib:compileDebugJava
:lib:processDebugJavaRes UP-TO-DATE
:lib:packageDebugJar
:lib:compileDebugNdk
:lib:packageDebugJniLibs UP-TO-DATE
:lib:packageDebugLocalJar UP-TO-DATE
:lib:packageDebugRenderscript UP-TO-DATE
:lib:bundleDebug
:lib:assembleDebug
:lib:signArchives
:lib:assemble
:lib:lint
Ran lint on variant release: 7 issues found
Ran lint on variant debug: 7 issues found
Wrote HTML report to file:/home/travis/build/SnowdreamFramework/android-log/lib/build/outputs/lint-results.html
Wrote XML report to /home/travis/build/SnowdreamFramework/android-log/lib/build/outputs/lint-results.xml
:lib:check
:lib:build
:lib:compileDebugTestNdk
:lib:preDebugTestBuild
:lib:prepareDebugTestDependencies
:lib:compileDebugTestAidl
:lib:processDebugTestManifest
:lib:compileDebugTestRenderscript
:lib:generateDebugTestBuildConfig
:lib:generateDebugTestAssets UP-TO-DATE
:lib:mergeDebugTestAssets
:lib:generateDebugTestResValues
:lib:generateDebugTestResources
:lib:mergeDebugTestResources
:lib:processDebugTestResources
:lib:generateDebugTestSources
:lib:compileDebugTestJava
:lib:preDexDebugTest
:lib:dexDebugTest
:lib:processDebugTestJavaRes UP-TO-DATE
:lib:validateDebugSigning
:lib:packageDebugTest
:lib:assembleDebugTest
:lib:connectedAndroidTest
Tests on test(AVD) - 5.0 failed: No test results
com.android.builder.testing.ConnectedDevice > hasTests[test(AVD) - 5.0] [31mFAILED [0m
No tests found.
:lib:connectedAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lib:connectedAndroidTest'.
> There were failing tests. See the report at: file:///home/travis/build/SnowdreamFramework/android-log/lib/build/outputs/reports/androidTests/connected/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 23.514 secs
travis_time:end:0e5eb826:start=1416651367667280733,finish=1416651451763431060,duration=84096150327
[0K
[31;1mThe command "TERM=dumb gradle build connectedCheck" exited with 1.[0m
Done. Your build exited with 1.
最佳答案
更新响应: 默认情况下,VM 镜像已包含修复的 android-wait-for-emulator 脚本和 android SDK 工具版本 24.0.0,以解决其他问题。 assemble: The task to assemble the output(s) of the project check: The task to run all the checks. connectedCheck: Runs checks that requires a connected device or
emulator. build: This task does both assemble and check Note that build does not depend on deviceCheck, or connectedCheck. checks requiring a connected device are launched with the anchor task
called connectedCheck. This depends on the task androidTest and therefore will run it. This
task does the following: When running connectedCheck and no tests are found, it should be
considered a failure. This will allow detecting issue where a bad setup leads to not running any existing tests. (Xavier Ducrohet) When running connectedCheck and no tests are found, it should be
considered a failure. The absence of tests is very different than
having tests and not having them run. This feature is for the latter
case (Jake Wharton)
Build Environment Updates - 2014-12-09
简要回复:
错误的脚本会导致您的模拟器没有准备好进行测试,并且您的应用程序由于超时未安装,因此没有执行测试并且构建失败,因为添加了一个新行为来提醒您有关此问题的问题。
解释:
您正在后台运行一个过时的 android-wait-for-emulator
脚本,该脚本在 ADB 服务器为 running
时退出,但您的模拟器未完全启动(需要 stopped
状态)(参见 0x2121215 点)。
由于您的模拟器尚未准备好并且存在两分钟 INSTALL_TIMEOUT
,您的构建失败并出现 InstallException
由 ShellCommandUnresponsiveException
引起的 0x2518122231343141(参见 0x2919192131411042 点 115131414141)。
您正在尝试测试运行一个命令而没有 --debug
信息的应用程序,您可以尝试我对评论的建议并使用 gradle installDebug --debug
并拆分构建(参见 点 2 0x25181914213)。
当您使用 Travis CI 构建服务器时,您需要将 logcat 和 connectedDevice 日志添加到它们的输出中。我为您提供了一种可行但可以改进的选项。使用您的应用模块 MOD_NAME=lib
(参见 点 5 )。
您需要管理并发,尽量避免在下载/安装 gradle 等时创建 AVD。如果您不需要它,可以使用 install: true
,但我建议您使用它来安装 gradle(请参阅 point 3 0x2518419242)。
当您不需要在模拟器上测试应用程序或者您仍然没有测试时,可以忽略此故障,但 Google 添加了此功能来检测问题,我不建议您禁用它(请参阅 point 1 )。
您可以禁用冲突依赖项的运行测试,但这不是您的问题,现在忽略它(参见 point 6 )。
我删除了关于测试样本和 SD 卡使用的 点 8 和 9 ,因为我的回复太长了,但是你在你的库中使用了 sdcard,你可能需要为你的 sdcard 定义另一个位置,我不知道。
解决模拟器问题,有时您可能会看到与错误核心 137 相同的错误或其他随机问题(请参阅 point 10 )。
您可以尝试重新加载作业,更改配置,使用 echo
以便服务器知道您的构建没有失败,使用 adb wait-for-device
,检查 adb device
状态,增加 0x251812241313 等。
如果您遵循其他要点,主要是使用另一个脚本并阅读日志,我相信您会检测并解决所有问题。
第一个回复编辑:
我不记得真正的原因,你没有分享足够的调试信息,但我在几周前的测试中解决了这个问题。我不确定,因为我将它保存为: # com.android.ddmlib.InstallException. connectedAndroidTest run tests failed, (exceed timeout).
# @-- Issue: https://code.google.com/p/android/issues/detail?id=69735 (now optimize/reload job).
# @-- 144.6 --@ Solution: https://android-review.googlesource.com/#/c/112780/ (inc. install time).
现在我想我知道解决方案了,我在之前的回复中添加了评论:
Point 1 是我在不知道原因时使用的解决方法,您现在不需要它。我们会解决的。
project.gradle.taskGraph.whenReady {
connectedAndroidTest {
ignoreFailures = true
}
}
Point 2 是另一种解决方法,可用于拆分构建并在不需要测试时避免问题。
您真正的问题是将您的应用程序安装在尚未准备好且似乎是测试问题的模拟器上。ADB_INSTALL_TIMEOUT
或 gradle build
。
见 http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Android-tasks
见 http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Running-tests
Point 3 是适用于 Travis Yaml 案例的最后一点。我总是覆盖安装阶段,所以我不确定他们当前是否默认使用他们的 gradle v2.0 执行 gradle assembleDebug assembleDebugTest
但你能做的最好的是确保在你不知道的情况下不执行任何操作并使用 gradle assemble
。install: true
作为脚本的 Travis 示例。或者 ./gradlew build
如果您没有使用 gradle 包装器。你真的有 gradle 包装器并使用 wget,我不明白。
install:
# Check install section: http://docs.travis-ci.com/user/build-configuration/#install
# If you'd like to skip the install stage entirely, set it to true and nothing will be run.
- true
script:
# By default Travis-ci executes './gradlew build connectedCheck' if no 'script:' section found.
- ./gradlew build
见 Travis CI skip tests (Gradle Android project)
第 4 点 是 Google 几周前添加的问题/功能,可帮助您了解问题所在。如果您使用 ./gradle build
,您可以阅读未执行测试的原因。由 ShellCommandUnresponsiveException 引起的 InstallException。
见问题:76249: Gradle should break if no tests are run
查看功能:108410: Running tests with no test found will now break the build.
Point 5 是我试图找到响应的第一个“bash/yaml/ruby 脚本”。确实需要改进,我只知道被解析为Yaml,我使用Bash手册并且被Ruby代码使用。我加了 ' ' 因为在 github 上看起来很丑,我在这里省略了。 --debug
行来自 here
我找到了,今天我找到了带有 after_failure 日志的构建:See lines 5073, 5161, 5184
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
Point 6 我添加这个只是为了完整性,但看起来很有用,我真的没有尝试过。现在忽略它。
Point 7 如果我没记错的话,我真的指出了您问题的主要原因,我认为脚本可以改进,因为我在打开有关模拟器的问题时试图解释。
您可以使用 Shubham Chaudhary 解决方法获取最新版本。
# Emulator Management: Create, Start and Wait
before_script:
- echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- curl http://is.gd/android_wait_for_emulator > android-wait-for-emulator
- chmod u+x android-wait-for-emulator
- ./android-wait-for-emulator
- adb shell input keyevent 82 &
见:second response here or use my script version
我删除了关于测试和 sdcard 的 点 8 和 9 ,所以我按照最终回复进行操作,但是你在你的库上使用了scard,我们没有默认安装的权限。
点 10
问题 1:“ConnectedDevice > hasTests[] FAILED 未找到测试。”
见问题:76249: Gradle should break if no tests are run
查看功能:108410: Running tests with no test found will now break the build.
由于调试日志显示 here 和有关它的 Google 搜索,问题 1 更改为
问题 2:Ddmlib 在 Device.java 超时时过于激进
见问题:69735 -Ddmlib is too agressive with timeouts in Device.java
查看功能:
112780 - ddmlib: Allow install timeout to be specified as an env variable
这些名称非常具有描述性,可能很有用,我认为它并等待该功能,但后来我修复了我的脚本和配置问题,但我不需要它。因此,问题 2 更改为:
问题 3:“模拟器已就绪”消息可能为假。
见问题:2932 - New android-wait-for-emulator script needs be fixed
参见修复:New android-wait-for-emulator fixed
请参阅自定义它的替代方法:Original public domain script fixed and comments
看推荐链接了解一下:Starting and stopping android emulators
我们在 x86 架构上运行 ARM 版本,没有 gpu-on 和有限的资源,我不知道目前是否可以在 VM 镜像上启用它,但 x86 模拟器版本可能会更好地工作。我们需要安装 KVM,我没有在 Travis 构建服务器上尝试过,也没有在 Travis 构建服务器上尝试过,也不知道是否可行,但我在我的计算机上按照 this guide 进行了安装。
android-21 模拟器需要更多时间准备好,似乎重要的字符串已从 For
更改为 not found
。 Travis 团队修复了它,但脚本将 device not found
重定向到 stderr
并且似乎 adb 服务器发送了误导性消息 stdout
。他们修复了它,但在更新 VM 镜像之前,您需要像我一样的新版本或替代版本。
如果您这样做并将日志添加到 Travis 输出,您将看到您的构建何时存在其他问题,如 sdcard 位置与否。如果您重新加载作业,这次模拟器可能已准备就绪。您在后台运行它,因此这取决于您在构建中所做的事情。如果您不管理并发性,那么一点点变化就可以让 Travis-ci 杀死一份工作。在创建 avd 文件系统时尽量避免下载。请记住,您使用 running
,因此您在子shell 上运行它,并且使用免费计划限制资源。我没有测试其他计划。
如果你不管理并发和资源,并针对你的具体情况设计了一个好的配置脚本,可能有时你的模拟器没有准备好,你看到错误137,你需要更高的&
等随机问题。您可以尝试重新加载作业,它可能在那个时候工作。
您可以使用 INSTALL_TIMEOUT
来确保模拟器状态为 adb wait-for-device
,然后再执行其他繁重的任务、拆分构建、禁用服务和使用您的资源。如果您禁用 sudo,您现在可以将 cache 用于公共(public)存储库。我正在测试它 here 。我目前没有使用缓存,但 container-based infrastructure 似乎工作得更快。所有的工作都是第一次工作,减去 380.6 的工作。发出 device
我认为也是你的问题,解决了它重新加载工作,但可能我需要改进我的 ShellCommandUnresponsiveException
配置文件。因此,我查找了您的问题,找到了我的日志并尝试改进此响应。
我建议您使用原始的公共(public)域脚本,修复更改的字符串并根据您的情况对其进行自定义。
关于android - com.android.builder.testing.ConnectedDevice > hasTests[test(AVD) - 5.0] 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27084948/