Android Studio Updating Android 5.0 SDK: “A folder

2020-06-28 17:07发布

While installing android sdk update this error A folder failed to be moved" pops up and even if I disable antivirus nothing happens and same error pop up appears.

标签: android sdk
3条回答
等我变得足够好
2楼-- · 2020-06-28 17:16

I was facing same issue, just closed android studio and click on 'yes' of retry dialog in sdk manager.

查看更多
我想做一个坏孩纸
3楼-- · 2020-06-28 17:17

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.

查看更多
疯言疯语
4楼-- · 2020-06-28 17:35

This issue is occurring many time when I try to update android sdk , I have seen few answer elsewhere but I answers are present here and there in semi correct form. So let me put method which worked for me

You get this error when you have downloaded all the sdk update and now sdk manager is trying to install it in same folder where sdk manager is placed. Hence sdk manager try to move folder and install update.

Steps to install this downloaded sdk updates

*locate sdk_directory: {directory where android studio is installed }\sdk*

1.Take a backup of the sdk tools folder (sdk_directory\tools) i.e. rename it as tools_backup  in case something goes wrong we can revert

back ( see note in case you face any problem while renaming )

2.open the sdk_directory\temp folder.There should be a zip named tools_r23.0.5-windows.zip or similar (may not be  exact name choose

highest number folder my case r23).

3.Unzip that. You should end up with a tools folder.

4.Copy all the files from this folder into sdk_directory\tools. Overwrite when asked.

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

Note: I faced problem while renaming tools folder while making backup because some process was using it. I followed this guide to find and end that process

For Future SDK Updates

  • Do Not Update From Android Studio or Eclipse

  • Go to sdk_directory\tools and run android.bat with administrator privileges .It will start sdk manager and you wont face problem
    discribed above

查看更多
登录 后发表回答