Can't update \tools - Android SDK Command Line Tools for Windows

burntsugar picture burntsugar · May 5, 2017 · Viewed 27.5k times · Source

I have just downloaded the Android SDK Command Line tools for Windows (26.0.2). I am attempting to download selected SDK components using \tools\bin\sdkmanager.bat, as well as updating \tools. The installation fails with the following message:

Warning: An error occurred during installation: Failed to move away or delete existing target file: C:\testinstall\sdk\tools Move it away manually and try again..

I don't see how I can remove \tools manually because it contains \bin\sdkmanager.bat.

Screenshot of the sdkmanager command:

enter image description here

All other components appear to install without error. See below for the components specified in my package file:

enter image description here

Answer

ahasbini picture ahasbini · May 8, 2017

Yeah that's quite funny. A way to do that is to copy the tools folder to another place (let's say C:\temp\). Then direct into the C:\temp\tools\bin\, open the cmd prompt there and run your update commands as such:

sdkmanager.bat --sdk_root=sdkRootPath --command

Where sdkRootPath is path to your original SDK folder (C:\testinstall\sdk\). Once that is done, delete the C:\temp\tools\ copied folder.