0

Everything was good. Today, I opened Android Studio, and every kotlin class code and even layout and value files turned into another format like XML. I don't know what kind of strange reason it is. I have been trying to fix this for 2 days now. even though I opened my files into some other editors(sublime, notepad)but the problem is still there.

I am attaching some screenshots MainActivity.kt.

I also tried these couple of things below

File > Sync project with Gradle files. Result: didn't solve my problem. File > Invalidated cache/restart. Result: didn't solve my problem.

Laurel
  • 5,965
  • 14
  • 31
  • 57
  • 1
    You might have a look here: https://stackoverflow.com/q/53249677. – Mike M. Feb 03 '23 at 18:10
  • 1
    I'm sorry, I don't know how to fix your issue. However, I'd advise you to look into version control (git). Version control allows you to easily roll-back any changes (among other things). This will help you avoid such problems in the future. – Serge Feb 04 '23 at 04:14

1 Answers1

0

Try this. Right-click on the file (e.g.: MainActivity.kt), then click on "Open In", it will open your explorer window. At this point open that file, which now you see in your explorer window, in a notepad, make a change (e.g.: adding a space where there is already a blank space) and save the file. Now Android Studio should see it correctly or, if not, try to restart Android Studio. If that works, do the same for all suddenly-changed files.

Lucas
  • 458
  • 4
  • 6