Android Studio Corrupted .java file after improper shutdown

后端 未结 9 683
梦谈多话
梦谈多话 2020-12-30 05:01

I hibernated my laptop when Android Studio was running and found later that the laptop had been shut down. Now one of my source files is appearing empty in Android Studio an

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 05:44

    First: always use source control. Git and similar DVCS's don't require a server and can create a repository for you locally.

    As for recovering your file, whether it's practical will be a matter of whether the disk blocks pointed to by the filesystem are correct; the fact that you're seeing \0 suggests that you're using an SSD and that the filesystem records have the right size but wrong block(s), meaning that recovery is unlikely. You should open the file with a hex editor and see whether any content past the initial few bytes is readable. If not, the file itself is almost certainly unrecoverable.

    However, IntelliJ includes a local-history feature that may have an older copy of the file.

提交回复
热议问题