gradlew: Permission Denied

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



gradlew: Permission Denied



I am attempting to run gradlew from my command line, but am constantly facing the following error.


Brendas-MacBook-Pro:appx_android brendalogy$ ./gradlew compileDebug --stacktrace
-bash: ./gradlew: Permission denied



I am already running this command from my project directory. Need to run this command as I am facing the same (nondescriptive) error on Android Studio 0.2.x as encountered here: Android studio and gradle build error



Am I doing something wrong and how do I get around this?




6 Answers
6



Try to set the execution flag on your gradlew file:



chmod +x gradlew


chmod +x gradlew





You mean, chmod +x gradlew? (: It worked. Please edit your answer so that I can mark it as the accepted one. Thanks!
– Brenda Nicole Tan
Jul 16 '13 at 6:35





I edited it already. You're welcome.
– Vincent
Jul 16 '13 at 6:37





is there some reason the default template doesn't already set gradlew as executable? it seems odd that i would have to do this.
– Ankur
Nov 8 '13 at 5:01





I had similar issue when setting up Atlassian Bamboo build; checking the gradlew file out from git it didn't have the executable attribute so had to add a "script" task to my job to chmod +x as @Vincent pointed out. Thanks!
– Doug Ayers
Dec 29 '13 at 0:29





@Abhijit you can check the file permissions by doing ls -l. This gives you the file permissions on the left-most column.
– Sudhanshu
Jun 19 '14 at 0:02


ls -l



Jenkins > Project Dashboard > (select gradle project) Configure > Build



x Use Gradle Wrapper



Make gradlew executable x





Does it work for you? I set the checkbox in my job's settings but it didn't lead to making gradlew executable. I use clean before checkout option.
– zubactik
Nov 25 '14 at 9:34


clean before checkout





it worked for me
– Dinesh Anuruddha
Nov 23 '16 at 9:13





Works for me! You have to tell jenkins explicitly to make the executable.
– Harvey Lin
Mar 22 '17 at 21:49



You could use "bash" before command:


bash ./gradlew compileDebug --stacktrace



Could also be fixed with




git update-index --chmod=+x gradlew



git update-index --chmod=+x gradlew



git update-index --chmod=+x gradlew



This command works better especially on non-unix system.



if it doesn't work after chmod'ing make sure you aren't trying to execute it inside the /tmp directory.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard