无法更新 Android Studio - 拒绝访问和 java.io.FileNotFoundException [英] Can't update Android Studio - Access Denied and java.io.FileNotFoundException

查看:82
本文介绍了无法更新 Android Studio - 拒绝访问和 java.io.FileNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在两台不同的 Windows 机器上将 Android Studio 从 0.5.1 更新到 0.5.2,一台装有 64 位 Windows 7 Pro,另一台装有 64 位 Windows 7 Enterprise.

I'm trying to update Android Studio from 0.5.1 to 0.5.2 on two separate Windows machines, one with Windows 7 Pro 64-bit and one with Windows 7 Enterprise 64-bit.

我得到正常的更新提示:

I get the normal update prompt:

...如果我选择更新并重新启动",补丁会下载并退出 IDE,但随后出现以下对话框:

...and if I choose "Update and Restart", the patch downloads and the IDE exits, but then I get the following dialog:

我无法更改任何解决方案"列条目.如果我点击继续",我会收到如下所示的消息(图像和文本,所以它的复制/粘贴/搜索友好):

I can't change any of the "Solution" column entries. If I click "Proceed", I get the following message as shown below (image and text, so its copy/paste/search-friendly):

Temp. directory: C:\Users\Sean\AppData\Local\Temp\

java.io.FileNotFoundException: C:\Program Files (x86)\Android\android-studio\lib\jsch.agentproxy.usocket-nc.jar (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at com.intellij.updater.Utils.copyStreamToFile(Utils.java:135)
at com.intellij.updater.CreateAction.doApply(CreateAction.java:52)
at com.intellij.updater.PatchAction.apply(PatchAction.java:140)
at com.intellij.updater.Patch$3.forEach(Patch.java:198)
at com.intellij.updater.Patch.forEach(Patch.java:248)
at com.intellij.updater.Patch.apply(Patch.java:194)
at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:86)
at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:77)
at com.intellij.updater.Runner.doInstallImpl(Runner.java:307)
at com.intellij.updater.Runner.doInstall(Runner.java:268)
at com.intellij.updater.Runner.access$000(Runner.java:18)
at com.intellij.updater.Runner$2.execute(Runner.java:258)
at com.intellij.updater.SwingUpdaterUI$7.run(SwingUpdaterUI.java:230)
at java.lang.Thread.run(Thread.java:744)

当我点击退出"时,Android Studio 会重新打开,并告诉我更新仍然可用.

When I click "Exit", Android Studio re-opens, and tells me that the update is still available.

我之前在两台机器上使用相同的方法更新了 Android Studio,没有出现问题.

I've updated Android Studio previously using this same method on both machines without a problem.

因为我认为这是 Android Studio 特定于新版本的某种错误,所以我打开了 问题 67794 在 AOSP 问题跟踪器上.

Since I believe this is some kind of bug with Android Studio specific to newer releases, I've opened Issue 67794 on the AOSP issue tracker.

编辑

我今天能够在两台机器上从 0.5.2 更新到 0.5.3 而没有遇到这个问题.我看到了 JetBrains 安装程序的 Windows 安全提示,就像之前成功的更新一样,并且更新成功完成,而我不必以提升的权限启动 Android Studio.所以,问题似乎是 0.5.1 或 0.5.2 补丁所特有的.

I was able to update from 0.5.2 to 0.5.3 today on both machines without encountering this issue. I was shown the Windows security prompt for the JetBrains installer as in previous successful updates, and update completed successfully without me having to start Android Studio with elevated permissions. So, seems the problem was something specific to 0.5.1 or 0.5.2 patches.

编辑

我在尝试从 Android Studio 0.6.0 更新到 0.6.1 时遇到了类似的错误:

I encountered a similar error when trying to update from Android Studio 0.6.0 to 0.6.1:

温度.目录:C:\Users\barbeau\AppData\Local\Temp\

Temp. directory: C:\Users\barbeau\AppData\Local\Temp\

+----------------文件操作失败.这可能是由于文件被另一个文件锁定应用.请尝试关闭任何应用程序使用正在更新的文件,然后按重试".+----------------

+---------------- A file operation failed. This might be due to a file being locked by another application. Please try closing any application that uses the files being updated then press 'Retry'. +----------------

com.intellij.updater.RetryException:无法删除文件 C:\Program Files (x86)\Android\android-studio1\lib\openapi.jar在 com.intellij.updater.BaseUpdateAction.replaceUpdated(BaseUpdateAction.java:40)在 com.intellij.updater.UpdateZipAction.doApply(UpdateZipAction.java:199)在 com.intellij.updater.PatchAction.apply(PatchAction.java:140)在 com.intellij.updater.Patch$3.forEach(Patch.java:198)在 com.intellij.updater.Patch.forEach(Patch.java:248)在 com.intellij.updater.Patch.apply(Patch.java:194)在 com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:86)在 com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:77)在 com.intellij.updater.Runner.doInstallImpl(Runner.java:307)在 com.intellij.updater.Runner.doInstall(Runner.java:268)在 com.intellij.updater.Runner.access$000(Runner.java:18)在 com.intellij.updater.Runner$2.execute(Runner.java:258)在 com.intellij.updater.SwingUpdaterUI$7.run(SwingUpdaterUI.java:230)在 java.lang.Thread.run(Thread.java:745)

com.intellij.updater.RetryException: Cannot delete file C:\Program Files (x86)\Android\android-studio1\lib\openapi.jar at com.intellij.updater.BaseUpdateAction.replaceUpdated(BaseUpdateAction.java:40) at com.intellij.updater.UpdateZipAction.doApply(UpdateZipAction.java:199) at com.intellij.updater.PatchAction.apply(PatchAction.java:140) at com.intellij.updater.Patch$3.forEach(Patch.java:198) at com.intellij.updater.Patch.forEach(Patch.java:248) at com.intellij.updater.Patch.apply(Patch.java:194) at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:86) at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:77) at com.intellij.updater.Runner.doInstallImpl(Runner.java:307) at com.intellij.updater.Runner.doInstall(Runner.java:268) at com.intellij.updater.Runner.access$000(Runner.java:18) at com.intellij.updater.Runner$2.execute(Runner.java:258) at com.intellij.updater.SwingUpdaterUI$7.run(SwingUpdaterUI.java:230) at java.lang.Thread.run(Thread.java:745)

如果您在 Gradle 构建过程仍在运行时尝试运行更新(例如,在您启动 Android Studio 之后),则似乎会发生这种情况.

This seems to happen if you try to run the update while the Gradle build process is still running (e.g., right after you start up Android Studio).

推荐答案

解决方法:

  1. 关闭 Android Studio.
  2. 右键单击Android Studio"图标并选择以管理员身份运行".
  3. 转到帮助->检查更新...",并完成正常的更新过程

在从 0.5.1 到 0.5.2 的几次更新尝试失败后,我意识到我不再收到允许 JetBrains IntellJ 安装程序继续的 Windows 安全提示,正如我在之前的成功更新中看到的那样.我不确定以前的更新有什么变化,但显然更新过程没有成功尝试访问没有适当权限的文件.通过上述过程将 Android Studio 提升为管理员解决了该问题.

I realized after a few failed update attempts from 0.5.1 to 0.5.2 that I was no longer getting the Windows security prompt to allow the JetBrains IntellJ installer to proceed, as I had seen in previous successful updates. I'm not sure what changed from previous updates, but apparently the update process was unsuccessfully trying to access files without proper permissions. Elevating Android Studio to admin through the above process fixed the issue.

如上述问题所述,从 0.5.2 到 0.5.3 的更新似乎不再出现此问题.

As noted in the question above, this issue no longer seems to occur with the update from 0.5.2 to 0.5.3.

编辑

为了修复我在从 Android 0.6.0 到 Android 0.6.1 更新时遇到的下一个错误,我关闭了 Studio,然后重新启动它,让它静置一夜(更多是巧合而不是设计).当我早上回到机器并运行更新时,它成功了.因此,似乎有某种长时间运行的过程会在某些条件下阻止更新(可能在启动后立即 - 可能是 Gradle 构建过程?).@Daniel Wilson 在下面的回答也适用于这种情况.

To fix the next error I encountered with the Android 0.6.0 to Android 0.6.1 update, I shut down Studio and then restarted it, and let it sit overnight (more by coincidence than design). When I returned to the machine in the morning and ran the update, it succeeded. So, it seems there is some kind of long running process that blocks the update under certain conditions (likely immediately after startup - possibly the Gradle build process?). @Daniel Wilson's answer below should also work for this scenario.

这篇关于无法更新 Android Studio - 拒绝访问和 java.io.FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆