zz Android Studio --“Cannot resolve symbol” 解决办法

 he symptom of this problem is usually that the build works fine from the command line (which means your build.gradle file is set up right) but you get syntax highlighting errors in the IDE. The solution is to click the Sync Project with Gradle Files button in the toolbar. We realize it's less than ideal that the IDE can't just take care of itself instead of for

Android Studio 没法识别同一个 package 里的其余类,将其显示为红色,可是 compile 没有问题。鼠标放上去后显示 “Cannot resolve symbol XXX”,重启 Android Studio,从新 sync gradle,Clean build 都没有用。html

多半是由于 Android Studio 以前发生了错误,某些 setting 出了问题。解决方法以下:less

点击菜单中的 “File” -> “Invalidate Caches / Restart”,而后点击对话框中的 “Invalidate and Restart”,清空 cache 而且重启。语法就会正确的高亮了。ide

相关文章
相关标签/搜索