Why is the source code 'all red' in Android Studio

♀尐吖头ヾ 提交于 2019-12-06 03:17:59

问题


I'm always using Android Studio's debugger to walk through the code and see how things work.

As I dive deeper into the SDK, I get to lisView.java for example, and now it's class members are mostly red? (see link)

Why is that?? I could see my code and parts of the SDK prior to 'stepping in' listView.java? Why suddenly is it all red on the right-had column?

As you see in the screenshot, now I can't see the value for the member variable, mOldItemCount for example.


回答1:


Try file -> invalidate caches / restart -> Invalidate caches and restart




回答2:


Sync Gradle and Rebuild Project.




回答3:


Possible Fixes:

  1. Sync Gradle
  2. Restart Android Studio
  3. Clean and Rebuild

A Possible other problem that can occur is that you moved the location of the file. Its happened to me before.




回答4:


When you have a red code like the image is because the autogenerate files and de gradle its not working well.

I try this options in order:

First, Check de import and be sure are the rigth imports

Second, Sync Gradle and Rebuild Project.

Third, Clean project

If the problem persist try checking the android dependencies and see which one is creating the problem.




回答5:


Try deleting .gradle and .idea folder of project. For me its solved the problem.




回答6:


Just removing .idea or at least files inside of it, even if while you're opening Android Studio a popup alert will be shown to tell you to reload your project and it everything will go back normally



来源:https://stackoverflow.com/questions/41665873/why-is-the-source-code-all-red-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!