简体   繁体   English

更新Android Studio后gradle同步失败

[英]gradle sync failed after updated android studio

I know this was asked a few times already in here, but most answers are for already working projects. 我知道这已经在这里被问过几次了,但是大多数答案都是针对已经在工作的项目的。

I just downloaded AndroidStudio 3.3.1. 我刚刚下载了AndroidStudio 3.3.1。 Now I started a new project and I instantly get an error, gradle sync failed. 现在我开始一个新项目,我立即收到一个错误,gradle同步失败。

So I watched in my settings, I have checked default gradle, so I changed to local and tried all paths I could find and diffrent help pages told me to try (the default from Android Studio, the one from the new project, one from a project I downloaded) but nothing seemeed to work. 因此,我查看了自己的设置,检查了默认gradle,因此我更改为本地并尝试了所有可以找到的路径,不同的帮助页面告诉我尝试(Android Studio中的默认值,新项目中的默认值,我下载的专案),但似乎没有任何作用。 Even if it found a gradle, it could not be synced. 即使找到了gradle,也无法同步。

I don't have "Offline Work" checked, like it seemes to get problems with that too. 我没有选中“离线工作”,似乎也遇到了问题。

I checked with my work-college, he has the exact same settings, for him they work, for me they don't. 我和我的工作学院核对过,他的设置完全相同,对他来说它们起作用,对我来说它们不起作用。

Is there anything else someone know I can do to fix this? 有人知道我可以做些什么来解决这个问题吗?

I found the problem... 我发现了问题...

When the project gets built, it builds the gradle online/loads the gradle. 构建项目时,它将在线构建gradle或加载gradle。 As it seems, my company network has blocked this, so it can't get built. 看来,我的公司网络已阻止了此操作,因此无法构建它。

Working over Hotspot it works perfectly fine. 在Hotspot上工作非常完美。

Thanks for all your kind help :) 感谢您的全力帮助:)

如果清理项目无助于尝试使缓存无效并使文件部分下的项目重新启动,请尝试清理“生成”部分下的项目。

Try this: 尝试这个:

On the right side of Android Studio there is source tree of project. 在Android Studio的右侧,有项目的source tree Select Project instead of Android from source tree options 从源树选项中选择Project而不是Android

Now delete the .idea and .gradle files/folders of project. 现在,删除项目的.idea.gradle文件/文件夹。 After that rebuild your project, if rebuild the project does not working then restart the Android Studio. 重建项目后,如果重建项目无法正常工作,请重新启动Android Studio。

I hope its work for you. 希望它对您有用。

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

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