简体   繁体   English

Android Studio 中的 SDK package 下载出错

[英]Error with SDK package download in Android Studio

java.io.IOException: Cannot download, response: 200 OK Warning: An error occurred while preparing SDK package Android Support Repository: Cannot download, response: 200 OK. java.io.IOException: Cannot download, response: 200 OK Warning: An error occurred while preparing SDK package Android Support Repository: Cannot download, response: 200 OK. java.io.IOException: Cannot download ' https://dl.google.com/android/repository/emulator-windows-3833124.zip ': dl.google.com Warning: An error occurred while preparing SDK package Android Emulator: Cannot download ' https://dl.google.com/android/repository/emulator-windows-3833124.zip ': dl.google.com. java.io.IOException: Cannot download ' https://dl.google.com/android/repository/emulator-windows-3833124.zip ': dl.google.com Warning: An error occurred while preparing SDK package Android Emulator: Cannot下载“ https://dl.google.com/android/repository/emulator-windows-3833124.zip ”:dl.google.Z4D236D9A2D102C50FE6AD1C50DA4. java.io.IOException: Cannot download ' Warning: An error occurred while preparing SDK package Google Repository: Cannot download java.io.IOException: Cannot download ' Warning: An error occurred while preparing SDK package Google Repository: Cannot download

I had this similar issue below worked for me.我在下面有这个类似的问题对我有用。 The solution for this is:对此的解决方案是:

  1. Run Android Studio as Administrator.以管理员身份运行 Android Studio。

  2. Re run the update.重新运行更新。

It will work.它会起作用。

delete uncompleted download in "[Android SDK folder]\\.downloadIntermediates".删除“[Android SDK 文件夹]\\.downloadIntermediates”中未完成的下载。 i solved my problem by this method.我用这种方法解决了我的问题。

you can manual download sdk:你可以手动下载sdk:

  1. https://dl.google.com/android/repository/platform-29_r04.ziphttps://dl.google.com/android/repository/platform-29_r04.zip
  2. https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip
  3. https://dl.google.com/android/repository/build-tools_r29.0.3-windows.zip https://dl.google.com/android/repository/build-tools_r29.0.3-windows.zip
  4. https://dl.google.com/android/repository/emulator-windows-6306047.zip https://dl.google.com/android/repository/emulator-windows-6306047.zip
  5. https://dl.google.com/android/repository/sources-29_r01.zip https://dl.google.com/android/repository/sources-29_r01.zip
  6. https://dl.google.com/android/repository/platform-tools_r29.0.6-windows.zip https://dl.google.com/android/repository/platform-tools_r29.0.6-windows.zip

Unpack to解压到

  1. C:\\Android\\Sdk\\platforms\\android-2 C:\\Android\\Sdk\\platforms\\android-2
  2. C:\\Android\\Sdk\\patcher\\v4 C:\\Android\\Sdk\\patcher\\v4
  3. C:\\Android\\Sdk\\build-tools\\29.0.3 C:\\Android\\Sdk\\build-tools\\29.0.3
  4. C:\\Android\\Sdk\\emulator C:\\Android\\Sdk\\模拟器
  5. C:\\Android\\Sdk\\sources\\android-29 C:\\Android\\Sdk\\sources\\android-29
  6. C:\\Android\\Sdk\\platform-tools C:\\Android\\Sdk\\platform-tools

Parsing解析

  1. C:\\Android\\Sdk\\build-tools\\29.0.3\\package.xml C:\\Android\\Sdk\\build-tools\\29.0.3\\package.xml
  2. C:\\Android\\Sdk\\emulator\\package.xml C:\\Android\\Sdk\\emulator\\package.xml
  3. C:\\Android\\Sdk\\patcher\\v4\\package.xml C:\\Android\\Sdk\\patcher\\v4\\package.xml
  4. C:\\Android\\Sdk\\platform-tools\\package.xml C:\\Android\\Sdk\\platform-tools\\package.xml
  5. C:\\Android\\Sdk\\platforms\\android-29\\package.xml C:\\Android\\Sdk\\platforms\\android-29\\package.xml
  6. C:\\Android\\Sdk\\sources\\android-29\\package.xml C:\\Android\\Sdk\\sources\\android-29\\package.xml

java.io.IOException: Cannot download , response: 200 OK Warning: An error occurred while preparing SDK package Android Support Repository: Cannot download , response: 200 OK. java.io.IOException:无法下载,响应:200 OK警告:准备SDK包Android支持存储库时发生错误:无法下载,响应:200 OK。 java.io.IOException: Cannot download ' https://dl.google.com/android/repository/emulator-windows-3833124.zip ': dl.google.com Warning: An error occurred while preparing SDK package Android Emulator: Cannot download ' https://dl.google.com/android/repository/emulator-windows-3833124.zip ': dl.google.com. java.io.IOException:无法下载' https://dl.google.com/android/repository/emulator-windows-3833124.zip':dl.google.com警告:准备SDK软件包Android仿真器时发生错误:无法下载“ https://dl.google.com/android/repository/emulator-windows-3833124.zip”:dl.google.com java.io.IOException: Cannot download ' Warning: An error occurred while preparing SDK package Google Repository: Cannot download java.io.IOException:无法下载'警告:准备SDK软件包时发生错误Google Repository:无法下载

run the studio.sh script with sudo:使用 sudo 运行 studio.sh 脚本:

"sudo ./studio.sh" “须藤./studio.sh”

if that does not work run:如果这不起作用,请运行:

"sudo chmod 777 -R /opt" “须藤 chmod 777 -R /opt”

without quotes should work没有引号应该工作

As shown in the android SDK video ./studio.sh has to be run, however if run without sudo or su, this might give problems like these.如 android SDK 视频中所示,必须运行 ./studio.sh,但是如果在没有 sudo 或 su 的情况下运行,则可能会出现此类问题。 So you should run with sudo or su as shown below:所以你应该使用 sudo 或 su 运行,如下所示:

  • sudo ./studio.sh(or /path/to/studio.sh)须藤./studio.sh(或/path/to/studio.sh)

or if you want to run as root或者如果你想以 root 身份运行

  • su
  • Password:root password密码:root密码
  • ./studio.sh or (or /path/to/studio.sh) This should fix the problem There might be a problem with /tmp if it is on a different partition and the partition has less space than needed to install ./studio.sh 或(或 /path/to/studio.sh)这应该可以解决问题 如果 /tmp 位于不同的分区上并且该分区的空间小于安装所需的空间,则它可能会出现问题

Hope this helps.希望这可以帮助。

I had Admin access on my Laptop, but still I faced this problem (also other packages were getting downloaded).我在我的笔记本电脑上有管理员访问权限,但我仍然遇到了这个问题(还有其他软件包正在下载)。 I found of that the https://dl.google.com/android/repository/android_m2repository_r47.zip file is quiet large, and in my case since my network speed was slow and I was attempting to download a large file on a slow network I concluded that it was failing for timeout.我发现https://dl.google.com/android/repository/android_m2repository_r47.zip文件很大,在我的情况下,因为我的网速很慢,我试图在慢速网络上下载一个大文件我得出的结论是超时失败。 I switched to a faster LAN and it got downloaded.我切换到更快的 LAN 并下载了它。

I had the same problem, I downloaded problematic file ' https://dl.google.com/android/repository/emulator-windows-3833124.zip ' and extracted it to C:\\Users\\$usrname$\\AppData\\Local\\Android\\sdk\\extras\\android.我遇到了同样的问题,我下载了有问题的文件“ https://dl.google.com/android/repository/emulator-windows-3833124.zip ”并将其解压缩到 C:\\Users\\$usrname$\\AppData\\Local\\ Android\\sdk\\extras\\android. It solved the problem for me.它为我解决了这个问题。

Hi I faced a similar issue... Turn's out that may be related to system configuration of your machine..嗨,我遇到了类似的问题......结果可能与您机器的系统配置有关..

Try downloading latest packages as per your system configuration from below:尝试根据您的系统配置从下面下载最新的软件包:

https://developer.android.com/studio/?gclid=Cj0KCQjwj9LkBRDnARIsAGQ-hUfGD0_yGXcqqZBN6d1Y-nMZ-TNKZtvdRBHimcE8m0tPYjyUw_bV77AaAsdzEALw_wcB https://developer.android.com/studio/?gclid=Cj0KCQjwj9LkBRDnARISAGQ-hUfGD0_yGXcqqZBN6d1Y-nMZ-TNKZtvdRBHimcE8m0tPYjyUw_bV77AaAsdzEALw_wcB

I have a similar problem.我有一个类似的问题。

And I notice some setting about Force https//... to be fetched using http://...我注意到一些关于Force https//... 的设置要使用 http://... 获取

After using it, my download run normally:使用后,我的下载运行正常:

在此处输入图片说明

I had a similar issue while installing in Mac Catalina:我在 Mac Catalina 中安装时遇到了类似的问题:

java.net.SocketException: Operation timed out (Read failed) Warning: An error occurred while preparing SDK package Sources for Android 29: Operation timed out (Read failed). java.net.SocketException:操作超时(读取失败)警告:为 Android 29 准备 SDK 包源时出错:操作超时(读取失败)。

First attempt using standard configuration - Failed第一次尝试使用标准配置 -失败
Second attempt using standard configuration - Failed使用标准配置的第二次尝试 -失败
Third attempt using Customer configuration, I selected the android simulator - Failed第三次尝试使用客户配置,我选择了 android 模拟器 -失败
Fourth attempt using Customer configuration, I selected the android simulator - Successful !第四次尝试使用客户配置,我选择了android模拟器 -成功

Not sure what was the reason, there is no change in any setting other than the above (and I am an Administrator of the Mac).不知道是什么原因,除上述之外的任何设置都没有变化(我是 Mac 的管理员)。

Find Android SDK folder.找到 Android SDK 文件夹。 (Usually C:\\User\\AppData\\Local\\Android\\sdk ) Delete folders which starts with dot( . ), they are temporary download files. (通常是C:\\User\\AppData\\Local\\Android\\sdk )删除以点( . )开头的文件夹,它们是临时下载文件。 Then delete Android Emulator from SDK Manager.然后从 SDK Manager 中删除 Android Emulator。 Then run Android Studio as administrator and then download and install Android Emulator again.然后以管理员身份运行Android Studio,然后再次下载并安装Android Emulator。 Now you can create emulator and use it without errors.现在您可以创建模拟器并使用它而不会出错。

Below steps fixed the problem for me -以下步骤为我解决了问题-

1. Download zip file from this location 1. 从这个位置下载 zip 文件
2. Extract it and move the emulator folder image for emulator folder into the SDK folder image for SDK folder 2.解压,将emulator文件夹的emulator文件夹image移动到SDK文件夹image for SDK文件夹中

I hope it works for you as well, I was using Windows 10 Pro 64bit我希望它也适用于你,我使用的是Windows 10 Pro 64bit

这个下载量需要高速互联网,如果你没有这个,它可能会显示这个错误。

Very often the cause of errors can be an interruption of the Internet connection.通常,错误的原因可能是 Internet 连接中断。 Just resume downloading with stable Internet.只需在稳定的互联网上继续下载即可。

As mentioned in the earlier comments, the problem might be because of slow internet connection, just to add more details, you need to download all the problematic file which you get in the logs, in my case they were (emulator-windows_x<>.zip and x86-30_r09.zip) and place them in the respective sub-folders ( PackageOperation02 or PackageOperation05 ..) present in .tmp folder located under andriod-sdk root folder and retrigger the sdk installation from Andriod studio.正如前面的评论中提到的,问题可能是由于互联网连接速度慢,只是为了添加更多详细信息,您需要下载您在日志中获得的所有有问题的文件,在我的情况下它们是 (emulator-windows_x<>. zip 和 x86-30_r09.zip) 并将它们放置在位于andriod-sdk根文件夹下的.tmp文件夹中的相应子文件夹( PackageOperation02 或 PackageOperation05 ..)中,然后从 Andriod Studio 重新触发 sdk 安装。

What Andriod-Studio will do after your action: It will first search the files in .tmp folder if they exist it wont download and simply unzip and initiate the installation from where it failed. Andriod-Studio 将在您的操作后执行的操作:它将首先搜索.tmp文件夹中的文件,如果它们存在,则不会下载,只需解压缩并从失败的位置启动安装。

I did not had android studio and was using only sdk manager.我没有 android studio,只使用 sdk 管理器。 It was downloading to a location of <your path>\\Android\\.temp Directory.它正在下载到<your path>\\Android\\.temp目录的位置。

Deleted the broken .zip file and re-ran the flutter run command.删除损坏的 .zip 文件并重新运行flutter run命令。

Simply click on menu: File then click ->Invalidate caches只需单击菜单:文件,然后单击 -> 使缓存无效

You may need to check optional if available如果可用,您可能需要检查可选

(clear file system cache and local history) (清除文件系统缓存和本地历史)

(clear vcs log cache and indexes) (清除 vcs 日志缓存和索引)

Then click Invalidate and Restart.然后单击无效并重新启动。

This will solve your problem.这将解决您的问题。

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM