Java PSI 和索引不匹配:PSI 和索引在 Android Studio 上不匹配
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28794723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PSI and index do not match: PSI and index do not match on Android Studio
提问by Yasmin12
Whenever I clean my project is says: PSI and index do not match What should I do?
每当我清理我的项目时都会说:PSI 和索引不匹配我该怎么办?
采纳答案by Scott Barta
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.
文件菜单 > 使缓存无效并重新启动。PSI 缓存是受此命令影响的缓存之一,因此应该修复它。
回答by Xargs
Whenever I navigated to a class, I'd get this PSI error. Clicking the details in Android Studio, it included the following:
每当我导航到一个班级时,我都会收到这个 PSI 错误。单击 Android Studio 中的详细信息,它包括以下内容:
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}}
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).
根据此信息,我尝试删除<user-directory>/.gradle/caches/modules-2
并重新启动 Android Studio,它似乎修复了 PSI 错误,并且似乎没有删除本地历史记录(尽管我不知道是否删除了其他重要内容)。
回答by Sultan Ahmad
Android Studio (windows) File -> Invalidate Caches/Restart...
Android Studio (windows) File -> Invalidate Caches/Restart...
then click on (Invalidate and Restart) button
然后单击(无效并重新启动)按钮
回答by Muhibbullah Muhi
I have also faced this problem. I have solved this by going to
File menu > Invalidate caches
and restart
.
我也遇到过这个问题。我已经通过去File menu > Invalidate caches
和解决了这个问题
restart
。
回答by Khalid
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.
使缓存无效对我不起作用。只有完全重新安装 AS 和所有相关的 SDK、Gradle 等……才能成功。我从卸载 AS 开始。然后我手动删除了SDK文件夹。我还删除了 C:/Users/[my.user]/ 文件夹中的 .gradle 和 .android 文件夹。