Problems with Gradle wrapper on Android build

Hi,
I am having trouble with an Android build, it seems to be struggling to find/use the Gradle wrapper. Here is my circle.yml file which is in the root of my project.

machine:
  environment:
    ANDROID_HOME: /usr/local/android-sdk-linux

dependencies:
  override:
     - chmod +x gradlew
     - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
  override:
    - ./gradlew test

The error message I get is:

`ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies
bash: line 1: ./gradlew: No such file or directory

ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies returned exit code 127

Action failed: ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies`

I have spent quite a few hours on this and am really struggling,

Thanks,

Clive

1 Like

@drazisil any idea?

@clivejefferies

Actually, I believe all of those steps should run by default.

Can you try deleting the circle.yml file (if that’s all that’s in it) and run again?

If you still have issues, can you PM me a build url so I can take a look?

Thanks @levla.

@drazisil I removed the circle.yml and am back to my original problem, which was a message saying that there are no tests. The build file I posted is just me trying to get the simplest thing working, once it is working I will have a lot more to put in, such as Firebase and Google Test lab. I will PM you the build URL.

Thanks,

Clive

To close the loop on this, the ./gradle/ directory had not been checked into the repository, causing the ./gradlew wraper script to fail when searching for it and giving the apperence that ./gradlew didn’t exist.

1 Like

Hi Drazisil - I’m actually getting the same issue, but it’s not clear from your comments above which ./gradle/ dir you’re talking about? I have project-name/android/gradle checked in and also the .gradle folder.

What else might be causing this?

ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies
bash: line 1: ./gradlew: No such file or directory

ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies returned exit code 127

Action failed: ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

Do you have the gradlew file checked into your repo? It’s normally in the root of the project.

It’s been a while since I touched an Android project, but I think it was the project-name/gradle directory.

1 Like

Yeah, i worked out it’s actually the ./gradlew file, and that sits in projectName > android > gradlew

So i fixed it by bolting on a:

general:
  build_dir: /android/
2 Likes