Android Studio“无法解析符号"但项目编译和工作 [英] Android Studio "cannot resolve symbol" but project compiles and works
问题描述
项目编译正常.但是,Android studio 3.0.1 以红色显示对一个特定库的引用,并显示无法解析符号".即使单步进入该库模块也不起作用.
The project compiles fine. However, Android studio 3.0.1 shows reference to one particular library in red and displays "cannot resolve symbol". Even single stepping into that library module doesn't work.
我已经尝试了各种选项,例如 1) 使缓存无效/重新启动 2) 删除构建目录 3) 清理并重建,但似乎没有任何效果.
I already tried various options like 1) Invalidate cache/restart 2) deleted build directory 3) clean and rebuild but nothing seems to be working.
有趣的是,当 Android Studio 在无效/重启后重建索引时,它会暂时显示库引用,但随后再次显示为红色.
Interestingly, when Android Studio is rebuilding indexes after invalidate/restart, it momentarily shows that library references in while but then again in red.
推荐答案
我尝试了 Invalidate cache/restart
或 clean Project ->重建项目
.这些对我不起作用.
I tried Invalidate cache/restart
or clean Project -> rebuild project
. These didn't work for me.
最终的解决方案是在IDE左侧打开Project窗口,在Project模式下,删除.gradle
和.idea
文件夹,然后同步,就可以了.
The final solution was open Project window on the left side of IDE, under Project mode, delete .gradle
and .idea
folder, then sync, it works.
这篇关于Android Studio“无法解析符号"但项目编译和工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!