Can't update Android Studio - Access Denied and java.io.FileNotFoundException

前端 未结 11 1972
青春惊慌失措
青春惊慌失措 2021-02-18 15:00

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

相关标签:
11条回答
  • 2021-02-18 15:11

    I solved a similar problem while updating Android Studio by just closing all other running applications, such as Firefox and restarted the update process.

    It seems that a file is just by another program and it cannot be accessed by Android Studio.

    Another way to solve this problem is to delete all files in the corresponding folder, such as: User/AppData/Local/Temp

    0 讨论(0)
  • 2021-02-18 15:17

    A workaround:

    1. Close Android Studio.
    2. Right-click "Android Studio" icon and select "Run as administrator".
    3. Go to "Help->Check for Update...", and go through the normal update process

    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.

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

    EDIT

    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.

    0 讨论(0)
  • 2021-02-18 15:17

    Don't re-install as an Administrator!

    Whilst running in Admin mode might make the update work, it may also affect the permissions that are set on any files that are added and/or updated, such that future operations in Android studio that use such files will need elevated (Admin) access to work properly.

    Doing this will result in many operations not working unless Android Studio has been run in elevated mode.

    Instead, deal with the file lock, then try again:

    Try killing all instances of java.exe (in Task Manager or Process Explorer), then re-attempt the update, but not running as Administrator.

    Every time I've used Process Explorer (on Windows) to check which application has a lock on one of the files that's blocked an Android Studio update, it's always been Java.

    What worked for me (on Windows):

    1. Download Process Explorer, and kill all instances of java.exe: in Process Explorer, sort by the Process column and find java.exe instances, press Del on the highlighted row. (On a side note, the file that's blocking the update, for example jsch.agentproxy.usocket-nc.jar, can be checked by pressing Ctl+F, and then entering the file name)
    2. If the update process doesn't automatically resume, kill it by dragging the target icon enter image description here to the update process' window - this locates it in Process Explorer's Process window - and then press Del to delete the process
    3. Re-run Android Studio (from start menu), and re-initiate update process.
    0 讨论(0)
  • 2021-02-18 15:21

    Disable antivirus and try update again.... Worked for me.

    0 讨论(0)
  • 2021-02-18 15:22

    I used LockHunter to see what was locking the files. Result: Adb had locked some of them (I was testing the application by wifi in a mobile phone). I killed adb server, restart the Android Studio and I was able to update it.

    Good luck for others!

    0 讨论(0)
  • 2021-02-18 15:25

    I had a Java process running in the background on my Windows machine that wasn't showing up in my Task Manager. This will make sure Java gets killed:

    taskkill /F /IM java.exe

    0 讨论(0)
提交回复
热议问题