android studio 无法解析符号“GradleException" [英] android studio cannot resolve symbol 'GradleException'

查看:39
本文介绍了android studio 无法解析符号“GradleException"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建新的 Android Studio 项目在 Gradle 构建文件中出现以下异常:

Creating new Android Studio project get the following exception in Gradle build file:

Cannot resolve symbol 'GradleException'

Gradle 仍能成功构建,但仍会在编辑器中显示此错误.

Gradle still builds successfully, but still shows this error in editor.

我的项目缺少什么?

Android Studio 3.3.2

Android Studio 3.3.2

Gradle 4.10.1

Gradle 4.10.1

compileSdkVersion 27

compileSdkVersion 27

推荐答案

注意:此答案不再适用于较新版本的 Android Studio 和 Gradle.请参阅此答案.

Note: this answer is no longer up-to-date for newer versions of Android Studio and Gradle. See this answer instead.

Android Studio 似乎有各种我不明白为什么存在的问题,但是通过使缓存无效并重新启动(从文件菜单项)来修复它们.因为代码编译得很好,这似乎是缓存条目以某种方式结束的情况之一,我不确定具体发生了什么,但基本上是阻止它正常工作的东西.

Android Studio seems to have various problems that I cannot understand why exist, but they're fixed by invalidating the caches and restarting (from the file menu item). Because the code compiles fine, it seems that this is one of those cases, in which a cache entry somehow ends up, I'm not really sure what specifically happens, but essentially something that prevents it from working properly.

因此使缓存无效并重新启动可能会出现这样的问题,无论是使用 Gradle 还是使用 Java/Kotlin/Scala/<在此处插入语言>.

So invalidating the caches and restarting may issues like this, whether it's with Gradle or with Java/Kotlin/Scala/<insert language here>.

这篇关于android studio 无法解析符号“GradleException"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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