Android Studio - 'Cannot resolve symbol' syntax highlighting errors although build is ok

后端 未结 3 1881
忘了有多久
忘了有多久 2020-12-19 09:26

I have a really annoying problem since several days, after I tried to restore a previously working Android Studio project from a backup, after getting a new computer.

3条回答
  •  执笔经年
    2020-12-19 10:02

    I had this very same problem with two libraries in our project, com.koushikdutta.ion and uk.co.senab.photoview which are used thoughout our multi-app project but are declared as dependencies deep down a library project. The symptoms were like this:

    • I could perfectly compile and run the application
    • The IDE stubbornly refused to find the classes of these libraries and no navigation to their source code was possible, lots of errors (red bars) were associated with all classes that used them; class usages were highlighted in red, no code suggestions, you name it.

    My solution is as follows: first of all, close Android Studio. Then :

    cd 
    mv .idea/ .idea-old/ 
    mv .iml .iml-old
    

    re-open Android Studio but select the option "Open an existing Android Studio project". Wait for the project to be reparsed and enjoy perfect cleanness.

提交回复
热议问题