可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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?
回答1:
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..
回答2:
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 !!
回答3:
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.
回答4:
Replace android.bat with latest version (r18).
It should be zipped in android-sdk/temp
Worked for me.
回答5:
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
回答6:
Remove Platform tools folder and close eclipse that worked for me api17
回答7:
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.
回答8:
If none of above worked, try this:
- Run task manager and close all java.exe instances.
- Goto android-sdk-windows\temp and open tools_rXX.X-windows.zip ( replace X
by latest version you've downloaded), now copy and replace it's content to
tools folder.
回答9:
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.
回答10:
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.
回答11:
@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.)
回答12:
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
回答13:
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.
回答14:
It's very simple. Follow these steps:
- Download windows installer r_20sdk for android.
- To install it on your system run SDK.
- Install all packages.
- Go to eclipse, navigate to window - preference - click android.
- Give the path of your sdk click apply and ok now run you SDK manager.
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.
回答15:
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.