./gradlew: No such file or directory using android Orb

Hello guys, I’m testing CircleCI to build our android app, following this article I wrote the configuration below, however, I’ve got an error: ./gradlew: No such file or directory

version: 2.1

orbs:
  android: circleci/android@2.1.2

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
  unit-test:
    executor:
      name: android/android-docker
      tag: 2022.08.1
    steps:
      - checkout
      - android/restore-gradle-cache
      - android/run-tests:
          test-command: ./gradlew testDebug
      - android/save-gradle-cache
  release-build:
    executor:
      name: android/android-machine
      resource-class: xlarge
      tag: 2022.08.1
    steps:
      - checkout
      - android/restore-gradle-cache
      - android/restore-build-cache
      - run:
          name: Assemble release build
          command: |
            ./gradlew assembleRelease
      - store_artifacts:
          path: app/build/outputs/apk/release

I found a way to fix it, but I don’t believe is the best way to resolve it, it’s time-consuming and will be performed every time.

  steps:
      - checkout
      - run: grandle wrapper
      - android/restore-gradle-cache
      - android/run-tests:
          test-command: ./gradlew testDebug
      - android/save-gradle-cache

Do you have any idea how to fix it?
Thx

Hello

You can resolve this issue by adding the gradlew to your VCS at the top level which will then be pulled by the checkout command.

You may need to change the permissions on the gradlew file within your config but this will resolve your issue.

Kind Regards
Owen Oliver