Gradlew: Permission denied

android

#1

Hi,
Trying first integration with android using circleci 2.0

My simple config.yml:

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: Run Tests
command: ./gradlew lint test

Always getting:
#!/bin/bash -eo pipefail
./gradlew lint test
/bin/bash: ./gradlew: Permission denied
Exited with code 126

Appreciate the help!


#2

Mark gradlew as executable within git. (after it was added to the index)

git update-index --chmod=+x gradlew

Or you can add a custom task before the failed task.

  - run:
      name: chmod permissions
      command: chmod +x ./gradlew

But solution 2 did not work for me when I was trying to build pull requests.


#3

Thank you very much!


#4

You can add permission before push,

You can try in your local machine with:

sudo chmod +x ./gradlew

And then add on git, create a commit and push to your repo again


#5