-------------------------------------------------------------------------------------------------

Android Studio 更新

Android Studio是今年5月份Google I/O 2013开发者大会上Google为Android开发者发布的一项全新的基于IntelliJ IDEA的Android开发环境。

官方网址:http://developer.android.com/sdk/installing/studio.html 。

目前(2013-09-25)发布的完整安装包版本为:130.737825,可通过patch补丁升级到版本:0.2.9(132.830170)。更新信息可查看:Recent Changes 以及:https://dl.google.com/android/studio/patches/updates.xml 。

可以在官网网址下载Google发布的最新完整安装包,然后通过菜单:Help -> Check for Update 来更新Android Studio。但是遗憾的是由于Android Studio的更新网址dl-sdk.appspot.com被封锁,所以你很可能看到如下界面:

常规途径被封锁,因此需要通过其他方法来升级。

我们可以使用VPN或者一些代理软件来更新Android Studio。我选择GoAgent代理软件来升级。安装配置完GoAgent,启动,显示如下:

然后在Android Studio中,选择 Files -> Settings -> HTTP Proxy -> Use proxy -> HTTP, 然后在Host name中输入:127.0.0.1,在Port number中输入:8087。选择 Ok,代理就设置完成了。然后再Check Update,依然失败。

Google到如下解决方法:https://code.google.com/p/android/issues/detail?id=56068#c3 。

1- If you can access the appspot URL via a browser, you should be able to do it via Studio directly by using File>Settings>HTTP Proxy. Configure your socks proxy there and use the "check connection" once, then try Help>Check for updates.

2- If the issue is with the appspot redirector, you can bypass it by setting an environment variable before invoking studio from the command line:

$ export REQUIRED_JVM_ARGS="-Didea.updates.url=http://dl.google.com/android/studio/patches/updates.xml -Didea.patches.url=http://dl.google.com/android/studio/patches/"
$ bin/studio

Once you start Studio, do step 1: go to file>settings>http proxy, set your socks proxy, check the connection, then use help>check for updates.

3- If that still fails, you can download the patch and apply it manually.
The patch is located at
http://dl.google.com/android/studio/patches/AI-130.687321-130.692269-patch-unix.jar
(syntax is "AI-$FROM-$TO-patch-unix.jar", where you get the from/to using the updates.xml file)
Once you have that file:
$ cd android-studio-directory
$ java -classpath /path/to/AI-130.687321-130.692269-patch-unix.jar  com.intellij.updater.Runner install $PWD

 

1.如果你可以使用浏览器访问网址dl-sdk.appspot.com,那么你可以通过File>Settings>HTTP Proxy来配置代理,然后通过Help>Check for updates尝试更   新。
2.如果appspot网址被重定向,你可以设置环境变量,然后使用代理(我使用的是ubuntu):
$ export REQUIRED_JVM_ARGS="-Didea.updates.url=http://dl.google.com/android/studio/patches/updates.xml -Didea.patches.url=http://dl.google.com/android/studio/patches/"
$ cd android-studio
$ bin/studio.sh
然后在android studio 中使用步骤1的操作来更新。
也可以将 export REQUIRED_JVM_ARGS="-Didea.updates.url=http://dl.google.com/android/studio/patches/updates.xml -Didea.patches.url=http://dl.google.com/android/studio/patches/" 加入到bin/studio.sh脚本文件中ALL_JVM_ARGS的赋值之前,这样直接执行studio.sh脚本即可
3.如果更新仍然失败,可以手动下载更新补丁patch,patch通过一下网址下载:
http://dl.google.com/android/studio/patches/AI-130.737825-132.830170-patch-unix.jar ,其命名规则为:
 linux: AI-$FROM-$TO-patch-unix.jar
  windows: AI-$FROM-$TO-patch-win.jar
  MacOS: AI-$FROM-$TO-patch-mac.jar
  其中的两个版本号,前一个FROM是你当前版本号,后一个TO是升级到的版本号。
下载文件到本地后,放到Android Studio程序根目录:
$ cd android-studio
$ java -classpath AI-130.737825-132.830170-patch-win.jar com.intellij.updater.Runner install .

 我使用步骤2配合GoAgent更新成功。Windows下使用GoAgent没有成功,貌似是GoAgent的证书的问题。可以使用步骤3,直接下载patch更新。

 写了个更新的脚本,python写的,支持Linux,Windows,MacOS操作系统。因为没研究过python,代码都是用到什么就google出来函数拼凑的,有需要的自己下载下来修改。

https://github.com/daemon369/Demo/tree/master/20130830

参考:

https://code.google.com/p/android/issues/detail?id=56068#c3

posted on 2013-08-18 18:48  Daemon369  阅读(4946)  评论(0编辑  收藏  举报