PSI and index do not match: PSI and index do not match on Android Studio

JavaAndroid StudioPsi

Java Problem Overview


Whenever I clean my project is says: PSI and index do not match What should I do?

Java Solutions


Solution 1 - Java

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.

Solution 2 - Java

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).

Solution 3 - Java

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSam12View Question on Stackoverflow
Solution 1 - JavaScott BartaView Answer on Stackoverflow
Solution 2 - JavaXargsView Answer on Stackoverflow
Solution 3 - JavaKhalidView Answer on Stackoverflow