简体   繁体   English

更新到新的Android Studio 3.1.2

[英]Updating to new Android studio 3.1.2

I just updated my Android studio and I am get this annoying error 我刚刚更新了Android Studio,但遇到了这个烦人的错误

Error: Could not download builder.jar (com.android.tools.build:builder:3.1.2): No cached version available for offline mode 错误:无法下载builder.jar(com.android.tools.build:builder:3.1.2):无缓存版本可用于离线模式

This error telling that gradle does not have offline files for com.android.tools.build:builder:3.1.2 and could not be downloaded in offline mode . 此错误告诉gradle没有com.android.tools.build:builder:3.1.2脱机文件,并且无法以offline mode下载。 So you will disable offline mode of android studio. 因此,您将禁用android studio的离线模式。

Go to File -> Settings. 转到文件->设置。

And open the 'Build,Execution,Deployment',Then open the 'Build Tools' -> 'Gradle'. 并打开“构建,执行,部署”,然后打开“构建工具”->“ Gradle”。

Then uncheck "Offline work" on the right. 然后取消选中右侧的“离线工作”。

Click the 'OK' button. 点击“确定”按钮。

Then Rebuild the Project. 然后重建项目。

For Mac go to AndroidStudio -> Preferences, rest is same. 对于Mac,请转到AndroidStudio->“偏好设置”,其余操作相同。

Here you go. 干得好。

What is offline mode : 什么是离线模式:

Now let' talk about offline mode, if you want to work offline, you can check the offline mode in the settings. 现在让我们谈谈离线模式,如果要离线工作,可以在设置中检查离线模式。 If you have checked this option, Gradle will use the cache for dependency resolution. 如果您选中了此选项,则Gradle将使用缓存进行依赖项解析。 If the files are not there in the cache, then it will result in a build error. 如果文件不在缓存中,则将导致生成错误。 You might get some errors, if you add some dependency, Gradle will not be able to resolve it since it's going to look into the cache itself.You might see a failed to sync error. 您可能会遇到一些错误,如果添加一些依赖项,则Gradle将无法解决它,因为它将查看缓存本身。您可能会看到同步失败的错误。 In case you receive this error. 万一您收到此错误。 Just uncheck the offline mode and sync again and then check the offline mode again. 只需取消选中离线模式并再次同步,然后再次检查离线模式即可。 Completely offline work is very difficult with the gradle system if you have to keep adding dependencies. 如果必须继续添加依赖项,那么使用gradle系统很难完全脱机工作。

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

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