Android SDK 管理器无法获取其他 SDK 平台。

40

2
看起来你是处于一个不允许你连接到这个位置的代理后面,或者你没有在eclipse中指定代理设置。参考:http://www.mkyong.com/web-development/how-to-configure-proxy-settings-in-eclipse/ - Dennis Jaamann
你能用浏览器打开这个URL吗? - Snicolas
在mac osx上遇到了相同的问题,找不到好的帮助。到目前为止只尝试过获取Android SDK时出了麻烦。。唉。 - Michahell
1
在Mac OS X中,手动创建文件~/.android/androidtool.cfg,并将以下行添加到其中: sdkman.force.http=true - Kasas
@Snicolas,我有同样的问题,但我可以用浏览器打开这个URL。 - eeshwr
@eeshwr,两年过去了,我已经不记得了,但我再也没有遇到这个问题了。抱歉。 - Snicolas
10个回答

106

尝试使用“http”而不是“https”。

转到Android SDK Manager->工具->选项...并勾选“强制使用http://...获取源 https: //...”

输入图像描述

此外,如果有任何代理设置,您也可以设置。


2
在我下载的ADT版本(2014年1月下载),此对话框位于Android SDK Manager -> Preferences...中,在Mac OS/X和显示花括号图标的Eclipse版本中。 - Prof Von Lemongargle
1
你在哪里找到这个窗口? - RollRoll
做完这个之后,我就再也没有收到任何更新了。 - Yoann Hercouet
退出后未保存 - S.M.Mousavi
谢谢@Luis Valdés - M.Alaghemand

22
在Mac OS X中,解决方案是在我们的用户. android文件夹中创建androidtool.cfg文件,然后添加此行。当然,这也适用于Linux。 sdkman.force.http=true 希望能对您有所帮助!

2
当使用tools/android应用程序来管理SDK时,此方法适用于OSX。 - Derek
我们是否应该在完成后立即删除那个开口?因为我们禁用了任何 Android 工具的 SSL,对吧? - Poutrathor
有在Windows上完成这个任务的任何方式吗? - nurettin

3

打开终端并输入以下内容:

root@gl:/etc/ssl/certs/java# keytool -list -keystore cacerts
Enter keystore password: [your pass]

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 0 entries

注意:密钥库的默认密码为“changeit”。 修复:要正确构建包含所有受信任 CA 证书的密钥库,请运行以下命令:
root@gl:~# rm /etc/ssl/certs/java/cacerts
root@gl:~# /var/lib/dpkg/info/ca-certificates-java.postinst configure

你应该能看到一个长列表,其中包含添加的证书(*.pem),最后显示“完成”。问题解决了。
这里找到了这个。

3
似乎这是Ubuntu(也许是其他基于Debian的发行版)中Java CACerts密钥库的问题。由于某种原因,它并不总是包括完整的条目列表。
为了解决这个问题,请尝试以下步骤:
1. 删除cacerts文件 sudo rm /etc/ssl/certs/java/cacerts
2. 使用dpkg postinstall脚本重新构建cacerts文件: sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure 这样就可以重新生成cacerts文件,并解决问题。

1
在Linux上,您可以通过以下方式修复它:

 ./android update sdk --no-ui -s

同时,您将获得以下提示:

 ./android update sdk --help

inmyfree@INMYFREE:/usr/local/bin/android-sdk-linux/tools$ sudo ./android update sdk --help
Error: Flag '--help' is not valid for 'update sdk'.

       Usage:
       android [global options] update sdk [action options]
       Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

                     Action "update sdk":
  Updates the SDK by suggesting new platforms to install if available.
Options:
  -f --force     : Forces replacement of a package or its parts, even if
                   something has been modified.
  -n --dry-mode  : Simulates the update but does not download or install
                   anything.
     --proxy-host: HTTP/HTTPS proxy host (overrides settings if defined)
  -s --no-https  : Uses HTTP instead of HTTPS (the default) for downloads.
  -t --filter    : A filter that limits the update to the specified types of
                   packages in the form of a comma-separated list of
                   [platform, system-image, tool, platform-tool, doc, sample,
                   source]. This also accepts the identifiers returned by
                   'list sdk --extended'.
  -u --no-ui     : Updates from command-line (does not display the GUI)
     --proxy-port: HTTP/HTTPS proxy port (overrides settings if defined)
  -p --obsolete  : Deprecated. Please use --all instead.
  -a --all       : Includes all packages (such as obsolete and non-dependent
                   ones.)

1
我是来自中国的用户。强制使用http对我没有用。
我在SDK工具的选项中设置了代理,这意外地起作用了!实际上我已经在Internet选项中设置了代理,但单独使用并不起作用。
所以,现在针对中国用户的解决方案如下(仅适用于Windows,Mac用户请尝试自己的方法):
  1. Internet选项中设置代理
  2. 为Android SDK Manager设置代理。 工具-选项-代理设置。

--------------------------- 抱怨的分割线 -----------------------

所有这些事情都让人感到沮丧...


1
如果http请求不起作用(就像我的情况一样),请尝试在选项菜单中清除或取消选中清单缓存。这对我解决了问题。

1
如果你在Mac OSX上仍然遇到错误,只需从“系统偏好设置”中禁用代理设置,然后通过其中一种方法在SDK管理器中设置代理即可。重新启动SDK管理器,它会要求你输入代理凭据。

1
今天我也遇到了同样的问题,安装了最新的JDK,并将环境变量JAVA_HOME和JDK_HOME设置为C:\Program Files\Java\jdk1.8.0_92(这是最新JDK的安装路径),更改了PATH的JDK部分后问题得到解决。

0

我在Ubuntu和OpenJDK上遇到了同样的问题,而“Force [...] http”这一解决方法对我有效,但从安全角度来看,我认为这不是最好的解决方案,所以我寻找了另一种方法来解决它:

问题是,某种原因导致Java Keystore中缺少Google颁发的CA证书,而这对于SSL连接非常重要。

要解决这个问题,首先从Google网站https://pki.google.com下载Google颁发的CA证书,然后打开终端并移动到/etc/ssl/certs/java目录下。

cd /etc/ssl/certs/java/

这个位置是Java密钥库。文件名为“cacerts”。现在,您需要使用以下命令将先前下载的证书添加到密钥库中。

sudo keytool -import -alias googleCA -file /yourdownloadlocation/GIAG2.crt -keystore cacerts

如果您之前没有更改过密码,密钥库的标准密码为“changeit”。 添加证书后,您应该能够使用https获取文件。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接