isuru
isuru

Reputation: 555

Android Studio can't open (port.lock access denied)

When I open the Android Studio it gives the following error:

java.io.FileNotFoundException: C:\Users\HP\.AndroidStudio2.2\config\port.lock (Access is denied)

The javac path is correct and the file has anyone can access (port.lock)

This is the full error message which I was getting:

java.io.FileNotFoundException: C:\Users\HP\.AndroidStudio2.2\config\port.lock (Access is denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at com.intellij.idea.SocketLock.underLocks(SocketLock.java:186)
    at com.intellij.idea.SocketLock.lock(SocketLock.java:128)
    at com.intellij.idea.StartupUtil.lockSystemFolders(StartupUtil.java:318)
    at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:140)
    at com.intellij.idea.MainImpl.start(MainImpl.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:93)
    at java.lang.Thread.run(Thread.java:745)

Upvotes: 2

Views: 4802

Answers (5)

Dhiraj Tinani
Dhiraj Tinani

Reputation: 1

My Android Studio was not opening and throwing the same error as above.

I went and deleted the below folder -

.AndroidStudio3.5 (It should be in C:/users/[insert current user]/.androidstudio3.5)

Delete the whole folder and try running the studio again.

Upvotes: 0

Leon
Leon

Reputation: 901

In my case, Java was installed under a different admin account on the default path, while I was trying to use Java under my admin account.
After a new installation of Java under my own admin account, the problem got solved.

Upvotes: 1

Praveen
Praveen

Reputation: 2177

I had the same problem and in my case the problem was with permissions for the config folder - for some reason the config folder was read only. I changed the permissions and it was ok.

Upvotes: 0

isuru
isuru

Reputation: 555

In my case i have to apply tick to hidden icons in also sub folders of C:\Users\HP and again apply tick to show hidden icons.Now works fine

Upvotes: 4

Kinjal
Kinjal

Reputation: 1193

Try to to delete everything under C:\Users\Administrator.gradle\caches. There is a cache.properties.lock that is holding a global lock which is preventing you from running your script. Using MacOS you will find it in your home directory ~/.gradle/caches

It Works for me. I hope It Should fix the problem.

Upvotes: 0

Related Questions