Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis CI gets stuck on starting build tools in Android

I am trying to add Travis CI to my Android project to run tests for me. Currently I am just trying to use the CI to build and clean my project, but it doesn't work, it appears to hang after a while and infinitely repeat things in the logs before eventually erroring out. Here is a sample of the log: https://gist.github.com/AdamMc331/6da4433a047815d8e072bf2b7fb81a44

I am completely baffled by this. I don't know what the issue could be. Below is my .travis.yml file:

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

I've tried adding --debug to the gradle task, but it didn't help much. Once the file hits that "trying to start build tools" line, there are no more [DEBUG] statements printed.

If anyone wants to fork the project and try it for themselves, I am using branch CC-46: https://github.com/AdamMc331/CashCaretaker/tree/feature/CC-46 If you look at settings.gradle file you'll notice I'm only using the utility and app-v2 modules right now.

Here is a log file when I run these commands locally in my terminal: https://gist.github.com/AdamMc331/6d0d0575aa170a760c84ad3244aed1b7

You can see that it also tries to start the build tools there, but it doesn't try 15 different times and it will eventually work without erroring out. The travis build must be doing something different.

like image 763
AdamMc331 Avatar asked Mar 20 '17 04:03

AdamMc331


2 Answers

Travis CI might kill gradle if the building process gets too intense, you may want to increase the memory and add some performance tweaks. Check if that works.

Try this on your gradle.properties file:

## 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

Edit: Try to downgrade your gradle from 3.3.0 to 2.2.3 as it doesn't compile on my projects either.

like image 198
Mauker Avatar answered Oct 16 '22 09:10

Mauker


I found some differences between your .travis.yml and working samples. Please try this one:

language: android
android:
  components:
    - tools
    - build-tools-25.0.2
    - android-25
    - platform-tools
    - extra-android-support
    - extra-google-google_play_services
    - extra-android-m2repository
    - extra-google-m2repository
  licenses:
    - '.+'

sudo: required

jdk:
  - oraclejdk8

before_script:
  - chmod +x gradlew

script:
  - ./gradlew clean build --stacktrace --info

I think the problem could be with license checks or requiring sudo, or (less expected) script section.

like image 24
Anton Malyshev Avatar answered Oct 16 '22 09:10

Anton Malyshev