Ameer Ameer - 3 months ago 20
Android Question

Travis CI - Android Project Build Failing

Reference build: https://travis-ci.org/ameer1234567890/Cevapr/builds/42053662

My .travis.yml is:

language: android
android:
components:
- tools
- build-tools-19.1.0
- android-19
- platform-tools

before_script:
- chmod +x gradlew


The error is:

./gradlew build connectedCheck
: No such file or directory
The command "./gradlew build connectedCheck" exited with 127.
Done. Your build exited with 1.

Answer

Your gradlew file uses Windows style (CRLF) and Travis-ci runs on Linux that uses Unix style (LF).

Copy the gradlew file from a trusted project as https://github.com/google/iosched/blob/master/gradlew

or change it using a text editor as vim and disable automatic conversion. Read this answer:

Source: Error with gradlew: /usr/bin/env: bash: No such file or directory

The problem's cause was that Git on Windows converted the line endings of gradlew from Unix style (LF) to Windows style (CRLF).

You can turn off that automatic conversion using:

git config core.autocrlf false

Setting the line endings of gradlew back to Unix style fixed the problem. In Vim this is done using:

set fileformat=unix

answered Mar 10 at 13:47 Matthias Braun