Android Studio 1.2.2 - Gradle Build Permission Denied

8.3k views Asked by At

I just get "Permission Denied" issue after reinstalling android studio 1.2.2 on my MAC OS X Yosemite 10.10.3.

I can build the android code in terminal by adding sudo in the beginning of gradle command. e.g. sudo gradle build or sudo ./gradlew build. However, even though I have successfully built the android app using terminal,it does seem annoying to me that I can't use the android studio as the yellow warning pop up to me (see screenshots)

Yellow Warning Pop-up in Android Studio

I have tried running the android Studio in root mode, but no luck.

sudo /Applications/Android Studio.app/Contents/MacOS/studio

In addition, I have also tried the solution by providing the executable mode for gradle files. I have added chmod +x gradlew in project directory (as you can see in the screenshot) and in studio directory at /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1

list of files## Heading ##

Does anyone have any idea how to fix the gradle permission denied in Android Studio 1.2.2?

3

There are 3 answers

0
rhzs On BEST ANSWER

I have managed to solve it.

Just remove the .gradle directory rm -fr .gradle in /Users/YOUR_NAME/.gradle. Then, execute the android studio in root mode.

0
tshele litabe On

you need to go to your project folder and right click. Then go to 'Get Info' a pop up appears. Then go down to a small lock on your right and click it. If asked for a password enter it and give permission. Then go back to the pop up and look for your name, click your name and and then look for a small * and next to it you will find a dropdown. Click it and it will open 'Apply to enclosed items'. Click it to give access and permission to your project. After that go to Android Studio and close your project and then restart Android Studio and run your project. The error should be gone, that is how I solved my problem too.

1
Aaron Lee On

Just add x permission to gradlew file in your project folder. Like this:

chmod +x gradlew