Android studio 是否需要互联网连接来构建项目 [英] Does Android studio need internet connection to build project

查看:340
本文介绍了Android studio 是否需要互联网连接来构建项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Android studio 0.4.2 版和 gradle 1.9 版.我已成功安装 Studio 并创建了多个项目.今天,当我没有互联网连接启动 Studio 时,

I am using Android studio version 0.4.2 and gradle version 1.9. I have successfully installed Studio and have created multiple projects. Today when I launched Studio without internet connection,

我收到此错误消息:

"Gradle 项目同步失败.基本功能(例如编辑、调试)将无法正常工作"并且事件日志窗口显示无法刷新 Gradle 项目 < 项目名称 >.连接计时出:连接.如果您使用 HTTP 代理,请配置IDE 或 Gradle 中的代理设置."

"Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly" and the Event Log window shows "Failed to refresh Gradle project < Project Name >. Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle."

我需要知道使用 gradle 构建项目是否必须连接互联网.

I need to know if internet connection is mandatory for building projects using gradle.

我认为 gradle 在互联网上检查最新版本并抛出连接超时错误.如果是这样,是否有任何解决方法可以禁用它.

I think gradle checks for latest version on internet and throws Connection time out error. If so, is there any workaround to disable that.

推荐答案

目前 Android Studio 的 Gradle 实现需要快速稳定的网络连接.无论出于何种原因,开发人员此时决定将这一要求强加给用户.您应该能够使用一个设置来利用本地 gradle 安装,但它不成立.开发人员知道网络要求和损坏的交换机,但目前正在优先考虑其他功能.他们可能在 1.0 版或 1.0 版后删除该要求.

Currently Android Studio's Gradle implementation requires a fast stable network connection. For whatever reason, the developers have decided to force this requirement on users at this time. There is a setting that you should be able to use to utilize a local gradle installation, but it doesn't hold. The developers know about both the network requirement and the broken switch, but are currently prioritizing other functionality. They may remove that requirement in the 1.0 or post 1.0 time frame.

[参见:https://plus.google.com/u/0/115692564989237473252/posts/LGSbniYqj3Q ]

Gradle 的离线模式不是.它应该正确命名为缓存模式.交换机所做的只是告诉 gradle 不要尝试上线,而是使用各种网络资源的缓存副本.不幸的是,假设您已经(并且将再次拥有)网络连接,最好是快速稳定的网络连接.使用具有缓慢/不稳定网络的 Android Studio(最新版本测试为 0.5.9)会导致观看 Android Studio 进程 Gradle(和 Maven)进程通常需要 2-5 分钟,有时需要 10 分钟或更长时间.此外,在编码 IDE 时,在看似随机的时间会锁定,原因通常涉及一个或多个已启动的 Gradle 进程.

Gradle's offline mode, isn't. It should be properly named cached mode. All that switch does is tell gradle to not try to go online and instead utilize cached copies of the various networked resources. Unfortunately that assumes that you have had (and will have again) a network connection, preferably a fast stable one. Using Android Studio (last version tested 0.5.9) with a slow/unstable network results in watching Android Studio process Gradle ( and Maven ) processes usually for 2-5 minutes, sometimes for 10 minutes or more. Also at seemingly random times when coding the IDE will lock up and the cause usually involves one or more Gradle processes that have spun up.

作为比较,使用 IntelliJ IDEA 13.1 社区版(Android Studio 所基于的 IDE)我比较了使用 Android Gradle 向导生成的默认Hello Android"IDE 程序(与 Android Studio 中唯一的一个基本相似)和基于 Ant 的 Android 向导.结果如预期.基于 gradle 的项目经历了与 Android Studio 中的项目相同的痛苦锁定和滞后.基于 ant 的 Android 项目几乎是瞬间完成的.创建并打开项目后没有明显的延迟.编码不会导致随机锁定.测试是在配备双 Athlon x2 处理器、6GB RAM 和 6Mb/0.75Mb DSL 连接的 Windows 8.1 update1 Pro 机器上完成的.我相信最后一部分很可能是问题所在.

As a comparison, using IntelliJ IDEA 13.1 Community edition (the IDE that Android Studio is based on) I compared a default "Hello Android" IDE generated program using the Android Gradle wizard (substantially similar to the only one in Android Studio) and the Ant based Android wizard. The results were as expected. The gradle based project experienced the same painful lock up and lag that projects in Android Studio exhibited. The ant based Android project was near instantaneous. No appreciable delay once the project was created and opened. Coding caused no random lockups. Testing was done on a Windows 8.1 update1 Pro machine with a dual Athlon x2 processor, 6GB RAM, and a 6Mb/0.75Mb DSL connection. I believe that last part is most likely the issue.

不幸的是,在 Android Studio 删除网络要求之前,我觉得它对大量开发人员来说是无法使用的.这是一种耻辱,因为否则它看起来是对现有的基于 Eclipse 的开发环境的显着改进.

Unfortunately until Android Studio removes the network requirement I feel it will be unusable to a large number of developers. That's a shame because otherwise it looks to be a marked improvement over the existing Eclipse based development environment.

这篇关于Android studio 是否需要互联网连接来构建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆