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

相關文章
相關標籤/搜索