Reputation: 39013
I'm trying to upgrade the Android SDK tools from revision 15 to revision 16. The update fails, claiming that a "folder failed to be moved":
Failed to rename directory C:\android-sdk\tools to C:\android-sdk\temp\ToolPackage.old01
I tried disabling my antivirus (as this problem has been reported by some people in 2009), and it didn't work. A fresh reboot didn't work, either. I'm encountering this problem on two different Windows 7 machines.
I did not encounter this problem upgrading from previous revisions all the way up to revision 15.
Anybody knows how I can circumvent this?
Upvotes: 41
Views: 41586
Reputation: 381
I know this is an old post but I want to write my personal solution to the problem:
Failed to rename directory C:\android-sdk\tools to C:\android-sdk\temp\ToolPackage.old01.
Obviously I have had the same issue and every time the Android tools needs to be updated it's a nightmare.
None of the solutions I found googling the net worked for me up now, but this is a vital job to maintain Android SDK updated. So I started to find an alternative working way to solve this issue and I found it finally.... at least... it works for me, even if it is a bit tricky.
The basic problem is that the android.bat batch file comes from the ~\tools\ folder and it's still in memory (running) while the same ~\tools\ folder needs to be updated (in our case, renamed).
The problem is that the android.bat runs java to launch swt.jar (the SDK tool), and it remains uselessly waiting for completion of this java program.
You can edit the android.bat and see the call in the latest row of this batch:
call "%java_exe% %REMOTE_DEBUG%" "-Dcom.android.sdkmanager.toolsdir=%tools_dir%" "-Dcom.android.sdkmanager.workdir=%work_dir%" -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*
The problem is the "call" CMD command. It waits for the called external program completion.
But ther's another way to run external programs from a batch file: the "start" command. It launches an external program and terminates.
So I just replaced the "call" command with "start", so that after the change the latest row of my android.bat was:
start "" "%java_exe% %REMOTE_DEBUG%" "-Dcom.android.sdkmanager.toolsdir=%tools_dir%" "-Dcom.android.sdkmanager.workdir=%work_dir%" -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*
Note: Keep the "" in between start and the application path. You can add text in those hyphens and this text will be the caption of the java.exe command window you will see after the changes. In my case I left the caption as an empty string but you can write there what you want.
After the changes, you can start the SDK and the android.bat will be no more waiting, leaving the SDK tool free to play (and rename the ~\tools\ folder without headaches).
Obviously, after updating the SDK tools, you have to redo the same changes in the new, updated android.bat batch file. This could be a bit unconfortable, but you'll have just to remember to make the changes before running the SDK tool and you'll have no other headaches while updating Android.
Upvotes: 1
Reputation: 4679
I tried all the various suggestions short of uninstalling and reinstalling the whole sdk and still got the error, including disabling thumbnails, which is the most common suggestion for folders you can't rename. I downloaded the free "processexplorer" from Microsoft to see what processes were using the folder, and after disabling all startup and non-Microsoft processes and finding no processes to be using the platform-tools folder, I still got the error, and found I couldn't rename it after the upgrade attempt.
The solution for me was to copy and paste the platform-tools folder found in the 'temp' folder in the android-sdk folder. Every upgrade I find a copy of the platform-tools in there, although for version 19 the platform-tools was zipped and the temp folder included versions of 18 and 17 which I left.
Upvotes: 0
Reputation: 51
To add to Subash's answer, if you have already attempted the upgrade, the tools zip file you need is in the android-sdk\temp folder.
Upvotes: 1
Reputation: 19134
If none of above worked, try this:
Upvotes: 1
Reputation: 137
First, you need to update ADT for your eclipse, my eclipse version is indigo
Then you can click "open android sdk manager" button to update your sdk to ver16
I have tried many method and this method help me to update it.
Upvotes: 1
Reputation: 11
It's very simple. Follow these steps:
Note: when you install sdk with the help of windows installer r_20SDK note the path or search the path in window search copy this.
Upvotes: 0
Reputation: 1
I think for those who still have the problem even if they already followed the answers here, try to see the processes in your system. Even if you close eclipse, sometimes it is still running in the background. So you can stop the process from the task manager.
Upvotes: 0
Reputation: 24039
On Windows8, upgrading from SDKr19 to 20, I got the cannot move folder error. It's at least handled a bit by the SDK installer, with error message and chance to retry.
Right click cmd.exe, select Open as Administrator, cd to SDK directory (mine was default)
cd C:\Program Files\Android\android-sdk
Now run the SDK manager, except this time you'll be as Admin and it'll be able to move folders etc. So run it by typing:
"SDK Manager.exe"
Follow standard upgrade procedure
Upvotes: 0
Reputation: 31
If you are unable to update Android SDK tools. Simply download the zip of android tools of version you want, and then replace the new tools directory with the old one. Then you are ready to go !!
Upvotes: 3
Reputation: 11
Remove Platform tools folder and close eclipse that worked for me api17
Upvotes: 1
Reputation: 21
Replace android.bat with latest version (r18). It should be zipped in android-sdk/temp
Worked for me.
Upvotes: 2
Reputation: 10067
Extracted from here:
INSTRUCTIONS:
- make a copy of the tools directory and call this new directory tools2.
- DO NOT USE 'SDK Setup.exe'.
- Instead open up a cmd.exe window as administrator and run the following from this new tools2 directory (obviously the full path on your local machine will be different): J:\android-sdk-windows>tools2\android.bat update sdk
Basically, as noted before in this thread, 'SDK Setup.exe' invokes tools\android.bat, which makes it impossible for it to rename the tools directory thereafter. It's a bit goofy and should never have passed QA validation..
Upvotes: 101
Reputation: 16912
@SERPRO solution. Warning, this solution downloads ALL packages for all API (levels). It works, but it is very slow and perhaps worse than just backing up your folders and re-installing the SDK (all together). At least this is my experience for Windows Vista + Cygwin.
More than one bug-report have been issued. Here is one of the later ones, but it seem that it is never resolved. (It's already 2 years old.)
Upvotes: 0
Reputation: 21
Update SDK version using Eclipse (button Open the Android SDK Manager), running android.bat from a local copy of tools directory didn't work for me.
Upvotes: 2
Reputation: 20031
you need Eclipse 3.6 Helios or 3.7 Indico to upgrade your ADT revision 16.
It wont be upgrade in Eclipse 3.5 Galileo.
New: December 12, 2011 - SDK Tools and ADT 16 released.
NOTE: ADT 16 requires Eclipse 3.6 or higher.
http://developer.android.com/sdk/requirements.html
Upvotes: 1