Permission to write to certain folder isn't obtained. Android Studio asks this. Only thing I can click on "Cancel" button.
Afterwards, when I want to leave Android Studio I get "could not save project".
Locked icons in Android studio.
I need any suggestion in what direction to look for solution?
You can click on the lock icon to toggle the READ-ONLY Option. The option can be found at the BOTTOM-RIGHT Corner of the Android Studio.
Remove the read-only attributeSome read-only files can be changed to allow for edits by removing the read-only attribute in the file properties. Right-click the file and select Properties. Uncheck the box for Read-only and click OK.
Read-only is a file attribute which only allows a user to view a file, restricting any writing to the file. Setting a file to “read-only” will still allow that file to be opened and read; however, changes such as deletions, overwrites, edits or name changes cannot be made.
The most likely explanation is that the directory and all its files are owned by a different user account on the system. Normally the "Clear Read-Only Access" dialog will fix up read permission problems if it's possible to do so; if it's not (because the files are owned by another user), the dialog will refuse to let you click the OK button.
You can confirm this by using the ls
command from the MacOS terminal. Here's an example from a random project of mine.
sbarta-macbookpro2:~/AndroidStudioProjects/ASProject$ ls -alh total 80 -rw-r--r-- 1 foo eng 438B Jan 9 10:54 local.properties -rw-r--r-- 1 foo eng 853B Jan 9 10:54 gradle.properties drwxr-xr-x 3 foo eng 102B Jan 9 10:54 gradle
If you run man ls
you can read the man page for the ls
command and get a lot more information on the output from the command, but the single "w" character in the output for each file tells me that those files are only writable by the file's owner. Those files are all owned by the foo user (which is what the third column of output means). I'm not foo when I'm running Android Studio, so I can't write to those files, and since I'm not foo, I don't have permissions to give myself write access to them.
You can fix it with the following command. Be very careful you use the correct path when you run this command; making large-scale filesystem changes under sudo
can do a lot of damage if you make a mistake.
sudo chown -R $USER /path/to/project/directory
There's probably a way to fix this through the Finder UI, but the command-line is pretty easy.
It will ask you for an administrator password, and after that it should make you the owner of those files and the "Clear Read-Only Status" dialog should work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With