android - Travis CI 在 Android 中启动构建工具时卡住了

标签 android travis-ci

我正在尝试将 Travis CI 添加到我的 Android 项目来为我运行测试。目前我只是尝试使用 CI 来构建和清理我的项目,但它不起作用,它似乎在一段时间后挂起并在最终出错之前无限地重复日志中的内容。这是日志示例:https://gist.github.com/AdamMc331/6da4433a047815d8e072bf2b7fb81a44

我对此完全感到困惑。我不知道可能是什么问题。下面是我的 .travis.yml 文件:

language: android

android:
  components:
    - tools
    - platform-tools
    - build-tools-25.0.2
    - extra-android-m2repository
    - extra-android-support
    - android-25

jdk:
  - oraclejdk8
script:
  - chmod +x gradlew
  - ./gradlew clean build --stacktrace --info

licenses:
  - android-sdk-license-.+

notifications:
  email: false

sudo: false

cache:
  directories:
    - $HOME/.gradle

我试过将 --debug 添加到 gradle 任务中,但没有太大帮助。一旦文件到达“尝试启动构建工具”行,就不再打印 [DEBUG] 语句。

如果有人想 fork 这个项目并自己尝试,我正在使用分支 CC-46:https://github.com/AdamMc331/CashCaretaker/tree/feature/CC-46如果您查看 settings.gradle 文件,您会发现我现在只使用了 utilityapp-v2 模块。

这是我在终端本地运行这些命令时的日志文件:https://gist.github.com/AdamMc331/6d0d0575aa170a760c84ad3244aed1b7

您可以看到它也尝试在那里启动构建工具,但它没有尝试 15 次不同的时间,它最终会正常运行而不会出错。 travis 构建必须做一些不同的事情。

最佳答案

如果构建过程过于紧张,Travis CI 可能会终止 gradle,您可能需要增加内存并添加一些性能调整。检查是否有效。

在你的 gradle.properties 文件上试试这个:

## Project-wide Gradle settings.
#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
org.gradle.daemon=true
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
#
# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true

编辑:尝试将您的 gradle 从 3.3.0 降级到 2.2.3,因为它也不会在我的项目中编译。

关于android - Travis CI 在 Android 中启动构建工具时卡住了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42895689/

相关文章:

java - Android 找不到符号方法 getMap()

c++ - Travis CI 上 Boost 中对 `std::__cxx11::basic_string 的 undefined reference

android -/dev/mem 和/dev/kmem 不存在?

android - 在两个 ViewPager 小部件的连接处添加 fab Button

npm - travis ci npm发布错误 "missing api_key"

android - 有没有办法在 Android Gradle 项目中只运行一组特定的仪器测试?

c# - Travis 无法找到 csharp 解决方案

ruby - 如何在 Travis CI 的 macOS 中更改 Homebrew 的 Ruby 版本?

android - 有没有办法检查 android WindowManager 是否已经包含一个 View ?

Java线程检查访问