简体   繁体   English

Android Studio无法打开(拒绝端口锁访问)

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

When I open the Android Studio it gives the following error: 当我打开Android Studio时,出现以下错误:

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) javac路径正确,并且该文件具有任何人都可以访问的文件(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)

在我的情况下,我必须对C:\\ Users \\ HP子文件夹中的隐藏图标应用刻度,然后再次应用刻度以显示隐藏图标。

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. 就我而言, Java是在默认路径下的另一个管理员帐户下安装的,而我试图在管理员帐户下使用Java
After a new installation of Java under my own admin account, the problem got solved. 用我自己的管理员帐户重新安装Java之后,问题解决了。

Try to to delete everything under C:\\Users\\Administrator.gradle\\caches. 尝试删除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. 有一个cache.properties.lock持有一个全局锁,这阻止了您运行脚本。 Using MacOS you will find it in your home directory ~/.gradle/caches 使用MacOS,您可以在主目录〜/ .gradle / caches中找到它

It Works for me. 这个对我有用。 I hope It Should fix the problem. 我希望它应该解决该问题。

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. 我遇到了同样的问题,在我的情况下,问题出在config文件夹的权限上-由于某种原因,config文件夹是只读的。 I changed the permissions and it was ok. 我更改了权限,没关系。

My Android Studio was not opening and throwing the same error as above. 我的Android Studio没有打开并抛出与上述相同的错误。

I went and deleted the below folder - 我去删除了以下文件夹-

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

Delete the whole folder and try running the studio again. 删除整个文件夹,然后尝试再次运行Studio。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM