Whenever I clean my project is says: PSI and index do not match What should I do?
3 Answers
Important note: This will wipe the shelf, local history, and potentially other cached data.
File menu > Invalidate caches and restart. The PSI cache is one of the caches that are affected by this command, so this should fix it up.

- 9,128
- 3
- 58
- 79

- 79,344
- 24
- 180
- 163
-
9Warning: This deletes shelved changes – Jon Aug 31 '16 at 20:09
-
4Is there way to wipe PSI cache only? – Binoy Babu Sep 07 '16 at 15:34
-
2After restart you might see `Indexing...` + gradle build actions that could take some minutes. – Junior Mayhé Jun 02 '17 at 14:45
-
"Open recent" history is preserved – Tassadar Jun 27 '17 at 17:43
Whenever I navigated to a class, I'd get this PSI error. Clicking the details in Android Studio, it included the following:
viewProvider=SingleRootFileViewProvider{myVirtualFile=jar://<user-directory>/.gradle/caches/modules-2/files-2.1/com.squareup.haha/haha/2.0.3/e0672395ac43377f2510b14839342a24fdf35c18/haha-2.0.3-sources.jar!/com/squareup/haha/guava/io/GwtWorkarounds.java, content=VirtualFileContent{size=5678}}
Based on this info, I tried deleting <user-directory>/.gradle/caches/modules-2
and restarting Android Studio and it seemed to fix the PSI error, and it didn't seem to delete local history (though I don't know if anything else important was deleted).

- 769
- 8
- 12
-
deleting the `modules-2` folder worked for me. Note: it requires that Android Studio is closed. (I use Android Studio 2.3.3 currently) – Someone Somewhere Jun 19 '17 at 12:49
Invalidating caches didn't work for me. Only a complete re-install of AS and all relevant SDK, Gradle etc... did the trick. I started by uninstalling AS. Then I manually deleted the SDK folder. I also deleted the .gradle and .android folders in my C:/Users/[my.user]/ folder.

- 1
- 1
- 2
-
Such a brutal method! :) Have you tried, for instance, to create a project in a new folder? As to me, new folder didn't work. But File > Invalidate caches / Restart... did. – CoolMind Feb 28 '18 at 14:04
-
Brutal indeed, i don't actually like it very much, but nothing else worked for me. New project did work. Invalidating cache didnt work. Even re-installing AS didn't work. I had to wipe every last trace, i wouldn't have gone to the extreme if the mild had worked. Surely there is a more elegant solution, I just didn't have that kind of time. – Khalid Mar 05 '18 at 10:51