Gradle permission denied in Circle 2.0 Exited with code 126

Hi
I am new to circle ci.
I follow the below link
https://proandroiddev.com/circleci-with-android-continuous-integration-3ecd98f92bd4

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
#      - run:
#         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
#         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Run Tests
          command: ./gradlew lint test
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results
      # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

i created the config.yml file directly from git website. and made a commit.

got an error like

#!/bin/bash -eo pipefaa il ./gradlew androidDependencies

/bin/bash: ./gradlew: Permission denied Exited with code 126

seen the same error for lot of people. but i didn’t get what exactly should do to solve this

command: |
            sudo chmod +x gradlew
            ./gradlew androidDependencies 

how to do the above thing to solve. should i change the file or. ?

  - run:
      name: Download Dependencies
      command: |
        sudo chmod +x ./gradlew
        ./gradlew androidDependencies 

Could you try this?

  `command: ./gradlew androidDependencies`

change to
command: sudo chmod +x ./gradlew

issue fixed

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.