Updating Android SDK: “A folder failed to be moved.”

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

enter image description here

  • How to make a PreferenceActivity launch a Dialog to set a custom preference
  • Android emulator not receiving push notifications
  • How to make Android ProgressBar determinate in code?
  • How Do I Split A String By Line Break?
  • Android app doesn't crash, but not responding on uncaught exceptions
  • Mobile webkit memory consumption
  • How do I fix this?

    Related posts:

    Where is log output written to when using Robolectric + Roboguice?
    Updating Android Tab Icons
    Google/Apple Push Notification Service (APNS/GCM)
    What is cursor.setNotificationUri() used for?
    Android - Which one to use Active Android or Realm
    Android refresh a fragment list from its parent activity
  • Difference between Phonegap and Sencha Touch
  • Batch Delete items with Content Provider in Android
  • android image button tooltip
  • Add a GridView to a ListView in Android
  • UiAutomator getLastTraversedText()
  • How to refresh image view immediately
  • 24 Solutions collect form web for “Updating Android SDK: “A folder failed to be moved.””

    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.

    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.

    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.

    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.

    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.

    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…

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

    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 …

    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.

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

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

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

    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.

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

    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.

    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.

    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.

    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 🙂

    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!!!

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

    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

    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.

    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.

    In Ubuntu following solved issue for me

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

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

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.