[英]How do I set up Android Studio to work completely offline?
I have very slow bandwidth, so I'm trying to keep all the required files on the local machine to work with Android Studio completely offline.我的带宽很慢,所以我试图将所有必需的文件保存在本地机器上,以便完全脱机使用 Android Studio。 When I click on "New Project" it always tries to download a file named gradle-1.6-bin.zip which I downloaded and tried to install locally via the plugin manager but it gives me an error:
当我点击“新项目”时,它总是尝试下载一个名为gradle-1.6-bin.zip的文件,我下载并尝试通过插件管理器在本地安装,但它给了我一个错误:
fail to load plugin descriptor from file gradle-1.6-bin.zip
无法从文件 gradle-1.6-bin.zip 加载插件描述符
So what other files do I need to download and how do I install them properly to work offline with Android Studio?那么我还需要下载哪些其他文件以及如何正确安装它们才能与 Android Studio 脱机工作?
Android Studio 0.4.0 now includes support for offline: Android Studio 0.4.0 现在包括对离线的支持:
http://tools.android.com/recent/androidstudio040released http://tools.android.com/recent/androidstudio040released
"You can now open the Compiler > Gradle options and enable Offline mode, which will tell Gradle to ignore update-to-date checks" “您现在可以打开编译器 > Gradle 选项并启用离线模式,这将告诉 Gradle 忽略更新到日期检查”
Updated Nov 2018: Now you can Open preferences, then search for "offline" and in the results select gradle and click "Offline work" 2018 年 11 月更新:现在您可以打开首选项,然后搜索“离线”并在结果中选择 gradle 并单击“离线工作”
I'm using Android Studio 0.5.4 (Mavericks).我使用的是 Android Studio 0.5.4(小牛队)。
Preferences → Gradle → Global Gradle Settings → Offline work
首选项 → Gradle → 全局 Gradle 设置 → 离线工作
OK guys I finally overcame this problem.好的伙计们,我终于克服了这个问题。 Here is the solution:
这是解决方案:
Download gradle-1.6-bin.zip
for offline use.下载
gradle-1.6-bin.zip
以供离线使用。
Paste it in the C:\\Users\\username\\.gradle
directory.将其粘贴到
C:\\Users\\username\\.gradle
目录中。
Open Android Studio and click on the "Create New Project" option and you will not get this error any more while offline.打开 Android Studio 并单击“创建新项目”选项,离线时不会再出现此错误。
You might get some other errors like this:您可能会遇到其他一些类似这样的错误:
Don't worry, just ignore it.别担心,忽略它。 Your project has been created.
您的项目已创建。
So now click on "Import Project" and go to the path C:\\Users\\username\\AndroidStudioProjects
and open your project and you are done.所以现在点击“导入项目”并转到路径
C:\\Users\\username\\AndroidStudioProjects
并打开您的项目,您就完成了。
Android Studio 1.3.1 has neither Android Studio 1.3.1 两者都没有
Gradle > Global Gradle settings > Offline work
nor a也不是
Compiler
menu.菜单。 To access the compiler menu, go to :
要访问编译器菜单,请转到:
File > Settings > Build, Execution & Deployment > Compiler > Compiler
and de-select Configure on demand
并取消选择
Configure on demand
The above still uses data but is faster, I was able to load images and maps.以上仍然使用数据,但速度更快,我能够加载图像和地图。 However, in addition, if you want to be completely offline, you need to do the following:
但是,此外,如果您想完全离线,则需要执行以下操作:
File -> Settings ->Build, Execution,Deployment -> Build Tools -> Gradle ->
check Offline work
检查
Offline work
Click the OK
button.单击
OK
按钮。
For Android Studio 2.0 it is the same procedure.对于 Android Studio 2.0,它是相同的过程。
Android Studio Version < 3.6: Android Studio 版本 < 3.6:
For Windows:对于 Windows:
File -> Settings ->Build, Execution,Deployment -> Build Tools -> Gradle
For Mac OS:对于 Mac 操作系统:
Preferences ->Build, Execution,Deployment -> Build Tools -> Gradle
Check/UnCheck Offline work
checkbox as per your need.根据您的需要选中/取消选中
Offline work
复选框。
Android Studio Version >= 3.6: Android Studio 版本 >= 3.6:
follow steps in the image:按照图片中的步骤:
Just as an assist if you go with Android Studio 0.4.x offline mode (because this thread is one of the main ones that google throws up when querying this issue).如果您使用 Android Studio 0.4.x 离线模式(因为此线程是 google 在查询此问题时抛出的主要线程之一),这只是一个帮助。
From Alex Ruiz (Google+):来自亚历克斯·鲁伊斯 (Google+):
If you specify dependency versions using "+" (eg 0.8.+) Gradle (not Android Studio) will check that you have the latest version of such dependency periodically (every 24 hours,) even in offline mode
如果您使用“+”(例如 0.8.+)指定依赖项版本,Gradle(不是 Android Studio)将定期(每 24 小时)检查您是否拥有此类依赖项的最新版本,即使在离线模式下
You need to take the plus out.你需要把加号去掉。
在 Android 0.5.1 上,您可以在 File / Settings / Gradle(在 Project Settings 部分)/ Offline work 中找到离线选项
Not sure if it was removed before, I heard it was kinda buggy in 0.5.8
but in AS 0.5.9
the settings is there:不确定它之前是否被删除过,我听说它在
0.5.8
中有点问题,但在 AS 0.5.9
,设置在那里:
Gradle > Global Gradle settings > Offline work
Gradle > 全局 Gradle 设置 > 离线工作
您可以从File->Build, Execution, Deployment->Build Tools-> Gradle-> Offline Work 启用。
文件 > 设置 > 构建、执行、部署 > Gradle > 离线工作
for a complete offline android studio 3.5.0 installation - you need to download all these below components对于完整的离线 android studio 3.5.0 安装 - 您需要下载以下所有组件
android studio, gradle, android gradle plugin and sdk. android studio、gradle、android gradle 插件和 sdk。
here is a detailed step by step Stackoverflow answer for the question这是该问题的详细步骤 Stackoverflow 答案
how to install android studio full offline 如何完全离线安装android studio
It seems as though gradle was not installed for me.似乎没有为我安装 gradle。 Going to
Android/Sdk/tools/templates/gradle/wrapper
and running ./gradlew tasks --debug
has resulted in it downloading.转到
Android/Sdk/tools/templates/gradle/wrapper
并运行./gradlew tasks --debug
导致它下载。
For enabling Offline mode Android Studio Version Above 3.6, refer the following answer. Android Studio Version 3.6 以上的离线模式可以参考下面的回答。
https://stackoverflow.com/a/64180290/4324288 https://stackoverflow.com/a/64180290/4324288
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.