Android doesn't build because ./gradlew permission denied


I’m unable to do a single build. My builds always fail from the very start with permission denied.

  1. The stack you’re using
    I try to use an Android stack.

  2. The exact error message you are getting
    "./gradlew: Permission denied Action failed: ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies"

  3. Which troubleshooting steps you’ve already taken
    I tried to give gradlew 777 (rwxrwxrwx) permission.

  4. Any recent changes either in the codebase or the stack
    It never built on circleCI succesfully

  5. What happens when you run the tests locally
    I can build the app locally perfectly

  6. What is supposed to happen when your build runs
    It should be successfully built.

  7. The build URL if the project is public

Can you help me what should I do in order to successfully build my project.

add chmod +x before executing gradlew in your circle.yml…that should do the trick…incase that doesn’t solve the problem for you share your circle.yml file.

hope this helps

okay I just realised that you had shared your github project

change the dependencies part of your circle.yml to the following…

- echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-21.1.2,android-21,extra-google-m2repository,extra-google-google_play_services,extra-android-support
- chmod +x gradlew
- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

1 Like

Thanks that was the trick

HI Archit,

My build is failing when I am using the chmod commad as suggested by you and I am getting the error as below:
chmod: cannot access ‘./gradlew’: No such file or directory

Could you please suggest where I could be going wrong.


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