Search code examples
androidandroid-sdk-manager

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


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


Solution

  • 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.