33

When trying to upgrade Android SDK Tools to revision 16, I am getting the following error:

Failed to rename directory C:\android-sdk-windows\tools to C:\android-sdk-windows\temp\ToolPackage.old01.

Done. Nothing was installed.

enter image description here

Nothing I try to do, including providing FULL permissions (in addition to the special permissions it already had) to Administrator, helps.

Also, I don't know of anything that is accessing those directories.

How do I fix this problem?

Regex Rookie
  • 10,432
  • 15
  • 54
  • 88

14 Answers14

68

This is how I fixed it in Windows 7:

Make a copy of the \tools folder, name it something like \copy. So you should have c:\android-sdk-windows\copy. Now run android.bat from the \copy folder with Admin privileges. This should prevent the issue with items currently being open in the \tools folder.

Will Tate
  • 33,439
  • 9
  • 77
  • 71
  • 1
    I tried giving FULL permissions to the entire `C:\android-sdk-windows` but that didn't help. I will try your tip now. What a horrible update system. Thanks +1 for now. – Regex Rookie Jan 12 '12 at 17:30
  • I don't have `android.bat` in `c:\android-sdk-windows\copy` or `c:\android-sdk-windows\tools` – Eugene Mar 27 '12 at 10:03
  • 1
    @Eugene is c:\android-sdk-windows\ the location to which you unzipped the Android SDK? – Will Tate Mar 27 '12 at 13:26
  • 1
    didnt help, I am getting the same message. – user1940676 Aug 14 '13 at 07:41
  • No Need to copy \tools folder to \copy folder. Just need to go to c:\android-sdk-windows\tools and run android.bat as admin privileges. It's working. for more details see this answer.. http://stackoverflow.com/questions/8555131/updating-android-sdk-a-folder-failed-to-be-moved#comment42795594_8568406 – Naitik Nov 26 '14 at 13:35
  • i ended the abd.exe task from the task manager and it worked for me after – user2209521 Feb 05 '15 at 22:12
  • @Jason Gao this is specifically for Windows – Will Tate Dec 16 '16 at 11:52
9

For me, it worked by simply deleting the contents of the temp directory in the SDK installation folder (C:\android-sdk-tools\temp in your case)

Christian García
  • 3,939
  • 1
  • 26
  • 26
7

Had the same issue with that and even tried with the copied folder. I had to run adb kill-server in the command prompt in the platform-tools directory for it to continue.

Jianxin Gao
  • 2,717
  • 2
  • 19
  • 32
exa42
  • 91
  • 1
  • 2
6

For me this problem was solved by running SDK Manager with administrator privileges

Roman Nazarevych
  • 7,513
  • 4
  • 62
  • 67
3

For me who I tried all the previous solutions and didn't work I solved my problem with the following sugestion (#16) on the link: https://code.google.com/p/android/issues/detail?id=4410 which is:

  1. Find the "temp" folder and you can find the "tools_r05-windows.zip" or other files which you will update.
  2. unzip it.
  3. here you will find the "tools_r05-windows" and copy all the files in the file. which should be updated file
  4. copy to the "tools" folder.
  5. OK.
arniotaki
  • 2,175
  • 2
  • 23
  • 26
2

I encounter this problem while adding compatibility package to project in eclipse.

I solved this issue by opening the eclipse with administrator privileges.

In Windows 7: Right click on eclipse.exe Run as administrator.

To make eclipse.exe to run as administrator always

Right click on eclipse.exe --> Properties -->Compatibility tab check the Run this program as an administrator check box under Privilege Level

Sid
  • 141
  • 1
  • 5
2

I ran into the same problem.

Most probably, you have a project opened in Eclipse (or android studio), and this project uses files that the SDK manager is trying to access or update.

So, the project is reading from some SDK platform folders/files, and the SDK manager is trying to overwrite it at the same time (for updating).

This is why you do not have permissions, not because you are not administrator.

Try closing Eclipse, click 'YES' in the SDK manager warning message (or re-run SDK manager again while Eclipse is not running).

Haitham Sweilem
  • 1,633
  • 1
  • 12
  • 13
1

I close the eclipse and run my android.bat (Path-To-YOUR-Android-SDK/tools/android.bat) from the command line.

It works for me

thanks

1

For anyone who is having this issue on OS X, sudo chown -R $USER worked for me (on your android-sdk directory).

yarian
  • 5,922
  • 3
  • 34
  • 48
0

Press ctrl + shift + esc to launch the task manager. Click on the Processes tab and sort the processes according to the command line column. Now search in the command line column for the same folder that contains /tools, click on it and click on End Process button. This will force all processes that use the same folder to be closed. Now open the SDK Manager again as administrator and it will work.

0

You can run SDK Manager outside eclipse directly from the androidSDK directory.

nonozor
  • 865
  • 2
  • 14
  • 24
0

In addition to the instructions given here by William, make sure you first delete the temp folder in the sdk folder. If it already exists, sometimes even creating a copy of the tools folder does not work. Therefore:

  1. Delete the sdk\temp folder.
  2. Create a copy of the sdk\tools folder as sdk\copy
  3. Run android.bat which is inside the copy folder, from a command prompt, with admin privileges. This will start the SDK manager
  4. Update the sdk as you normally do when the SDK manager starts.
  5. Delete the sdk\copy folder
docpkd
  • 551
  • 9
  • 19
0

i have another solution, that helped me. 1. When you got error message in SDK Manager, copy zip file (name contains version and 'tools' word) from sdk/temp folder; 2. Exit from SDK Manager; 3. Unzip archive from first item, you got new tools, and replace sdk/tools with new one; 4. Clean sdk/temp folder;

ultraon
  • 2,220
  • 2
  • 28
  • 27
0

Right click on "android-sdk" folder > properties > security > set full control permission for "ALL APPLICATION PACKAGES" and press OK, it take some minutes for sett this permission in all sub directories.

MrSalesi
  • 377
  • 3
  • 17