Search code examples
javaandroidtravis-ci

Travis CI Android build keep failing with gradlew no such file


my travis ci build keeps failing with,

$ chmod +x /.gradlew chmod: cannot access ‘/.gradlew’: No such file or directory The command "chmod +x /.gradlew" failed and exited with 1 during .

I tried all the suggestions, different yml files but cant get rid of this error.

My travis yml is on root directory, the here is my folder structure

root: /src .gitignore .travis.yml

src: /client /server

client: /app /gradle/wrapper build.gradle gradle.properties gradlew gradlew.bat settings.gradle

Here is my travis.yml

sudo: false
language: android
jdk:
  - oraclejdk8
android:
  components:
    - tools
    - platform-tools
    - tools

    # The BuildTools version used by your project
    - build-tools-25.0.3

    # The SDK version used to compile your project
    - android-25
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository
    - addon-google_apis-google-19

before_install:
  - chmod +x /.gradlew
script:
- "/.gradlew clean build"
notifications:
  email: false

and here is my build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
    }
}
task wrapper(type: Wrapper) {
    gradleVersion = '2.3.3'
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Any suggestions? Thanks


Solution

  • To debug this you could change the before_install section to print current directory and list its contents.

    before_install:
      - pwd
      - ls -la
      - chmod +x /.gradlew