25

Currently I have Android SDK 2.1 (+ tools revision 4). I'd like to upgrade to Android SDK 2.2. When I try to do it I'm informed I need to upgrade Android SDK Tools to revision 7 first. So I agree, the process starts and then I get an error:

-= warning! =- A folder failed to be renamed or moved. On Windows this typically means that a program Is using that Folder (for example Windows Explorer or your anti-virus software.) Please momentarily deactivate your anti-virus software. Please also close any running programs that may be accessing the directory 'D:\Install\Programming\android-sdk-working-dir\android-sdk_r04-windows\android-sdk-windows\too!s'. When ready, press YES to try again.

Downloading Android SDK Tools, revision 7 Installing Android SDK Tools, revision 7

Failed to rename directory D:\Install\Programming\android-sdk-working-dir\android-sdk_r04-windows\android-sdk-windows\tools to D:\Install\Programming\android-sdk-working-dir\android-sdk_r04-windows\android-sdk-windows\temp\ToolPackage.old01.

I am aware of http/https and antivirus issues. So I disactivated my AV. I also closed any application that might hold a handle to the folder. Eclipse is also closed (I start the manager via command line). However I still get the same error.

Looks like the only app that can hold a handle to the folder is the manager itself, because its starting directory is the one the error complains about ('\tools').

I am on Win XP Pro + SP3. I run as admin.

Does anyone have an idea?

Vit Khudenko
  • 28,288
  • 10
  • 63
  • 91

19 Answers19

47

I think they fixed this problem in the later version of the tools, but I ran into this a while back. Here's what I did:

  1. Copied tools\ to scrap\ within the SDK directory
  2. Ran android from the scrap\ directory
  3. Did the upgrade
  4. Deleted the scrap\ directory when done

I might have had to also change environment variables (e.g., PATH) that had been pointing to tools\ to point to scrap\ during this process -- I'm a bit fuzzy on the details.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks a lot! It worked. BTW, I did not have do any changes to environment variables (e.g., `PATH`). The only trouble was I had to reboot the PC in order to be able to delete the `scrap\` directory. – Vit Khudenko Dec 05 '10 at 21:37
  • Wow..this solution really works.. I don't really understand why the update process tries to rename the same folder from which it is itself running and then throws this silly error. Anyways..i solved my issue..thanks a lot. –  Jan 12 '11 at 10:52
  • 1
    I didn't need to reboot the PC to delete the scrap directory - just had to "adb kill-server". – Robert Dec 27 '11 at 21:51
  • 2
    "Ran android from the scrap\ directory" what do you mean by this? – hemanth kumar Jan 10 '12 at 11:59
  • 1
    There is batch file named "android" in /scrap (former /tools) directory. Run it to start "standalone" Android SDK manager. – vladexologija Jan 23 '12 at 21:13
  • adb kill-server and just retry. – Apirak Lunla Mar 23 '12 at 16:03
  • My case that packages are downloaded but not installing ,it was asking to close adb.exe.....help me – Crishnan Kandada Oct 22 '13 at 11:53
10

Try just kill adb.exe process. It worked. for me.

bivy
  • 216
  • 2
  • 10
8

Simply running "android.bat" (located in the tool folder) as admin worked fine in my case.

Josh Darnell
  • 11,304
  • 9
  • 38
  • 66
xiorcal
  • 81
  • 1
  • 1
8

In eclipse goto Window -> Android SDK and AVD manager and upgrade from there. Worked in my case.

Manish Negi
  • 81
  • 1
  • 1
2

Make sure you run SDK Manager as an administrator (Right-click and choose run as administrator). If running it from the command line, start the command line as an administrator.

2

None of these worked for me.

I modified the android.bat file in the scrap\ directory i had tried to update the original tools\ directory. I replaced the "%tools_dir%" with the the correct path (keeping the quotes).

call

%java_exe% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir=%work_dir% -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*

Hussain
  • 5,552
  • 4
  • 40
  • 50
2

I had this issue and I tried every above solution but those were didn't work.

Then I downloaded the android SDK and reinstalled it, soon after I managed to get update all Android API tools by opening up the android SDK Manager.

By the way Android.4 seems awesome, the best mobile OS I have ever had.

Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
DeadManSpirit
  • 2,036
  • 2
  • 20
  • 27
1

The trouble is java.exe which is locking the \tools folder. However java.exe is started by running SDK Manager itself. However when using the scrap method described above (ie running android.bat from \scrap folder) java.exe is NOT locking \tools nor scrap .

It just uses

C:\Users\<USERNAME>\AppData\Local\Temp\temp-android-tool .
Hussain
  • 5,552
  • 4
  • 40
  • 50
Stef
  • 11
  • 1
1

What worked for me is updating from a new workspace with no projects, setting the Android SDK location to the same as the previous workspace, and updating from there. I think the projects are holding on the folder.

Tried the admin fix but that didn't work for me. Also I'm already updating from the Android SDK and AVD manager so that's not the solution. And killing the adb.exe just gave me a lot of errors. I kept getting the folder error, even after rebooting.

dr3x
  • 917
  • 2
  • 14
  • 26
1

The folder is locked by the packages under the repository. For each package under the repository, change the android version, restart the eclipse and then run the update again. The error message should not be appear.

HWW
  • 11
  • 1
1

Running the avd manager by itself (without starting eclipse) worked for me.

Ian
  • 3,500
  • 1
  • 24
  • 25
1

This has worked for me:

The SDKManager lock itself while reading the source.property file located at \tools\
I've used the Process Explorer utility from Sysinternals as follows:

1º execute Process Explorer
2º Choose "Find File or DLL" and search for "property"
3º Double-click on the file listed located at tools folder
4º At the bottom window right-mouse on file and choose "Close handle"
5º Try again to continue with the installation

So long,
Jose

BlackBishop
  • 737
  • 1
  • 7
  • 18
1

Like Jose, I was able to find a running process that had files open in the Tools folder, but in my case it was a previous version of the SDK Manager that had crashed. I used similar steps (on Windows 7) to find it :

Used the Process Explorer utility from Sysinternals as follows:

  1. execute Process Explorer
  2. Choose "Find File or DLL" and search for "tools"
  3. Double-click on the file listed located at tools folder
  4. At the bottom window right-mouse on file and choose "Close handle"
  5. Try again to continue with the installation

Cheers,

Johno!

Johno Scott
  • 1,730
  • 18
  • 13
1

Just install this

http://download.cnet.com/Unlocker/3000-2248_4-10493998.html

and kill the proccess that use the folder

Siavash
  • 21
  • 1
  • 8
1

I faced this very same problem a lot of times (unable to move platform-tools folder). I tried everything copying tools to a 'scrap' folder and running the android.bat and turning off anti-virus and explorer that might possibly be suing the tools folder. None of thse worked unfortunately.I came across a solution in some forum which worked for me.

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.

This is a manual update of the platform tools and later you can update the SDK version to the latest as well..

ramesh
  • 11
  • 1
0

Unable to upgrade tools with the program running. Close the SDK. Replace the folder tools for the contents of the zip file into the temp folder manually.

wattostudios
  • 8,666
  • 13
  • 43
  • 57
Lucas
  • 1
0

Building off Lucas's answer:

I kept running into a Destination Folder Access Denied in trying to update/replace /tools/lib/ files. Here was my fix:

You can delete the /tools/ folder then manually add it again and manually move items from the latest /temp/ zip version to your /tools/ folder.

Gaʀʀʏ
  • 4,372
  • 3
  • 39
  • 59
0

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.

Androidcoder
  • 4,389
  • 5
  • 35
  • 50
0

i manually ran android.bat and I had to run as admin

Ian Hern
  • 641
  • 1
  • 8
  • 16
  • 1
    that was not my case, since I already run that as Admin. BTW, the question has been solved months ago... – Vit Khudenko Aug 18 '11 at 19:54
  • I understand that it was solved months ago Arhimed but these questions are a useful resource for other people having problems. I had the same problem and fixed it following the above instructions AND running as admin. – Ian Hern Feb 17 '12 at 16:07
  • Just edited the question, so it now states explicitly I run as admin. Hopefully it'll prevent any further buzz on that. :) – Vit Khudenko Feb 17 '12 at 17:49