Updating Android SDK: "A folder failed to be moved."

AndroidSdk

Android Problem Overview


While trying to update my Android SDK I am encountering this error when trying to install this particular package:

enter image description here

How do I fix this?

Android Solutions


Solution 1 - Android

This happens once in a while on my Windows SDK (even when I don't have any antivirus or similar programs running, execute the SDK-Manager as an administrator and so on).

I just update the tools by hand in this case. Which means close the SDK-Manager after the error and open the ANDROID_SDK\temp folder. There should be a zip named tools_R16.zip or similar (don't remember the exact name). Unzip that. You should end up with a tools folder. Copy all the files from this folder into ANDROID_SDK\tools. Overwrite when asked. And take a backup of the SDKs tools folder beforehand, just in case something explodes.

After that, start the SDK-Manager again. The tools version should be updated.

Solution 2 - Android

The problem seems to be that Eclipse, or even the SDK Manager itself, locks the folder. Running android.bat from the tools folder should do the trick.

Solution 3 - Android

If you launched the SDK Manager from Android Studio then all you need to do is close Android Studio.

I presumed the SDK Manager was a modal dialog that was part of Android Studio - not a separate program.

Solution 4 - Android

thanks. this is how I fixed it:

I updated the tools by hand in this case. Which means close the SDK-manager after the error and open the folder android-sdk-windows folder. Using LockHunter, unlock all programs from holding a lock on the android-sdk-windows\tools\ folder. http://lockhunter.com/?ver=&vertype=pro&sm=main_window_64

RENAME the android-sdk-windows\tools folder beforehand to tools_DELETEME There should be a zip named android-sdk-windows\temp\tools_r19-windows.zip. open that, You should see a tools folder in it. Copy that tools folder to android-sdk-windows\tools

After that, start the SDK-manager again. The tools version should be updated.

Solution 5 - Android

When you install tools/softwares use SDK manager. But don't use it when update. Do right click -> Run as administrator on android-sdk-windows\tools\android.bat file for updating tools. Always try to run commands as Administrator specially on Windows Vista/7/8. That'll fix most of permission issues etc...

Solution 6 - Android

You probably started the SDK manager from eclipse? I encoutnered the same problem, and fixed it by manually opening the SDK manager from the directy tools.

Solution 7 - Android

My solution was to start it from within eclipse - as Administrator.

Solution 8 - Android

well i had the same issue on windows 7 ... problem is that during the update it tries to rename the tools folder (inside the SDK folder) and that folder is used by a process "ADB" which is currently running ...

so you cannot do the update smoothly until you stop / kill that process ...

BTW copy pasting the new contents of tools folder from the temp would also work ...

Solution 9 - Android

With windows 7, when "failed to install popup" appears kill the process called adb (from task manager ctrl+alt+del) then press "Yes" and stuff is being installed.

Solution 10 - Android

I tried running android.bat and got the same error.

What worked for me was using unlocker to unlock the \tools folder.

Solution 11 - Android

Ensure you don't have any essential files or folder opened/being used by other applications including explorer.

Solution 12 - Android

I've read before, people take a copy of the platform-tools folder and run the update from a different location. This ensures you haven't got open the files it's trying to update.

Could also disable your antivirus for 5 minutes o0o0.

Solution 13 - Android

On Windows 7 and probably Vista, run Eclipse as administrator.

Solution 14 - Android

My problem was Windows 7 security. I opened up the security on C:\Program Files\Android to EVERYONE with FULL access and it then worked. I then removed EVERYONE after the update was complete.

Solution 15 - Android

I had to make a copy of the tools folder itself (keeping it at the same directory tree level, thus "tools" and "tools-copy" were both in the "android-sdk-windows" folder). Then ran Android.bat from that copy.

After the update just delete the tools-copy folder.

Solution 16 - Android

The error message was Failed to rename directory C:\devtools\android-sdk\system-images\android-21\google_apis\x86 to C:\devtools\android-sdk\temp\SystemImagePackage.old01. I deleted the C:\devtools\android-sdk\temp\SystemImagePackage.old01 directory by hand (it was a leftover? I don't know) and it was able to proceed.

Solution 17 - Android

Same error i got while updating sdk. It is because of targeted folder locked (access permission is denied). You can resolve it as follows in "Ubuntu" :-

Press ALT + F2 and type 'gksudo nautilus' and navigate to the targeted folder like tools or extras and give create and delete permission. then update, every thing will be working fine :)

Solution 18 - Android

First make a copy of tools folder in same directory (android-sdk or android-sdk-windows) then delete the original tools folder and then open the android.bat file by double clicking in tools-copy folder to launch sdk manager and install the tools.

If tools folder is not being deleted then use the unlocker LockHunter to delete the folder and then open android.bat to update the tools.

After successful installation of tools delete the tools-copy folder.

Close Eclipse or Android Studio if open.

It worked for me!!!

Solution 19 - Android

On my PC it was caused by monitor.exe running in the background. Terminating that proces solved the problem.

Solution 20 - Android

Close the currently launched android studio window from task manager by going to the studioprocess (So when closed there are currently no active studio windows). Then go to Android studio in windows explorer, select the studio64/studio(if 32 bit OS) and right click and select run as administrator. In one line - you need to run Android Studio as a administrator. enter image description here

Solution 21 - Android

These are the steps followed by me.

  • Restart the computer.

  • Open "C:\android\androidStudio\sdk\tools\android.bat" as admin.

  • Now install packages should run fine.

Solution 22 - Android

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.

Solution 23 - Android

In Ubuntu following solved issue for me

  1. cd [tools/directory/path]
  2. sudo ./android

Solution 24 - Android

Solved this on my side by killing the adb.exe in Task Manager.

Solution 25 - Android

I just stopped the emulator, and problem was solved.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKyle V.View Question on Stackoverflow
Solution 1 - Androiduser658042View Answer on Stackoverflow
Solution 2 - AndroidKyle V.View Answer on Stackoverflow
Solution 3 - AndroidJasonView Answer on Stackoverflow
Solution 4 - AndroidhamishView Answer on Stackoverflow
Solution 5 - AndroidTharangaView Answer on Stackoverflow
Solution 6 - AndroidNanneView Answer on Stackoverflow
Solution 7 - AndroidJonView Answer on Stackoverflow
Solution 8 - AndroidvirtualoneView Answer on Stackoverflow
Solution 9 - AndroidMauno VähäView Answer on Stackoverflow
Solution 10 - AndroidnothingView Answer on Stackoverflow
Solution 11 - AndroidVDALLCOView Answer on Stackoverflow
Solution 12 - AndroidBlundellView Answer on Stackoverflow
Solution 13 - AndroidTimothy Lee RussellView Answer on Stackoverflow
Solution 14 - AndroidTonyView Answer on Stackoverflow
Solution 15 - AndroidL. G.View Answer on Stackoverflow
Solution 16 - AndroiddenispyrView Answer on Stackoverflow
Solution 17 - AndroidRam Prakash BhatView Answer on Stackoverflow
Solution 18 - AndroidDhruvam GuptaView Answer on Stackoverflow
Solution 19 - AndroidMirosView Answer on Stackoverflow
Solution 20 - AndroidDJphyView Answer on Stackoverflow
Solution 21 - AndroidSiddarth KantedView Answer on Stackoverflow
Solution 22 - AndroidradiolondraView Answer on Stackoverflow
Solution 23 - AndroidSekarView Answer on Stackoverflow
Solution 24 - AndroidmbwasiView Answer on Stackoverflow
Solution 25 - AndroidMilad MoosaviView Answer on Stackoverflow