Android Studio file mapping problem, not recognize files

情到浓时终转凉″ 提交于 2019-12-12 19:17:14

问题


Please look at snapshot of the opened file below.

When I double click on MyUtils.java it is showing this XML format:

But when I open it manually from Windows Explorer it already have correct Java code inside:

I have tried these but the problem remains:

  • clean, rebuild project
  • invalidate cache and restart
  • deleted .gradle and .idea auto generated folders from the project
  • updated and restart Studio.

回答1:


It happens because of wrong File Encoding and you can see my answer about it in here.

Solution: The solution will be reinstalling Android Studio or, go to:

File -> Other Settings -> Default Settings, find File Encodings, change Project Encoding to System-Default or UTF-8 format.




回答2:


  • try 'Sync Project with Gradle Files'. you can find it in top-left in 'File' tab or click on button at the left of 'Avd Manager' button.

  • go to Project mode and right click on the root folder of your project and Synchronize it




回答3:


Actually you do not need to reinstall the Android Studio.

I met with the similar problem. The way to fix it is if you are using MAC OS then goto

'Android Studio->Preferences->Editor->File Types'

then check the Recognized File Types and look for your bug file in Registered Patterns and remove it.

Then all be good.



来源:https://stackoverflow.com/questions/52781040/android-studio-file-mapping-problem-not-recognize-files

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