Unable to update \ tools - Android SDK command line tools for Windows

I just downloaded the Android SDK command line tools for Windows (26.0.2). I am trying to download selected SDK components using \ tools \ bin \ sdkmanager.bat, as well as updating \ tools. When the installation is complete, the following message appears:

Attention: an error occurred during installation: Failed to delete or delete the existing target file: C: \ testinstall \ sdk \ tools Retract it manually and try again.

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

Screenshot of sdkmanager command:

enter image description here

All other components seem to be installed without errors. See the components listed in the package file below:

enter image description here

+26
android android-sdk-manager
source share
6 answers

Yes, that’s pretty funny. The way to do this is to copy the tools folder to another location (say C:\temp\ ). Then go to C:\temp\tools\bin\ , open the cmd prompt and run your update commands as such:

 sdkmanager.bat --sdk_root=sdkRootPath --command 

Where sdkRootPath is the path to the source SDK folder ( C:\testinstall\sdk\ ). After that, delete the copied folder C:\temp\tools\ .

+31
source share

it may be a resolution problem. Can you try sudo or if you try to start the terminal as an administrator on Windows.

I saw problems when the program cannot delete the folder due to a lock or some strange reason.

+1
source share

Run cmd at the root of c :.

 c:\>testinstall\sdk\tools\bin\sdkmanager --package_file=c:\testinstall\packx.txt 
+1
source share

You can temporarily rename it to tools.old , run it to install the new version in tools , and then delete the old one.

 cd YOUR-ANDROID-SDK-LOCATION ren tools tools.old tools.old\bin\sdkmanager.bat "tools" dir tools* del tools.old /q /s tools\bin\sdkmanager.bat --list 
+1
source share

Perhaps this is not the answer to your question, but now I can’t remember the version exactly, you can not directly update the SDK tools or use Eclipse, sdk Manager, sdk.bat or android.bat, only the way to update them using Android Studio . This is a new Google policy, I read it somewhere if I find a link that I will share it

0
source share

My solution was as follows:

  • Uninstall Android SDK Tools through Android Studio (although it may complain that it failed).
  • Close Android Studio
  • Manually delete the tools folder from the C:\Users\<MyUsername>\AppData\Local\Android\sdk
  • Launch Android Studio, and then install the Android SDK Tools through Android Studio.
0
source share

All Articles