Java 在 Android Studio 中恢复文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30049250/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 09:02:13  来源:igfitidea点击:

Recover file in Android Studio?

javaandroidandroid-studio

提问by Confuse

I created a project in Android Studio (Version 1.2) and after working on that project for a few weeks, my PC suddenly shut down (Android Studio was open at that time).

我在 Android Studio(版本 1.2)中创建了一个项目,在该项目上工作了几个星期后,我的电脑突然关闭(当时 Android Studio 是打开的)。

After starting the PC again, I found that one of my files was completely erased.

再次启动电脑后,我发现我的一个文件被完全删除了。

Here is the snapshot of the workspace -

这是工作区的快照 -

my workspace

我的工作区

As you can see, nothing is left on that file.

如您所见,该文件中没有任何内容。

Is there any way to recover that file? I am using Ubuntu 14.04.

有没有办法恢复那个文件?我正在使用 Ubuntu 14.04。

采纳答案by Pasi Matalam?ki

Can you find the file in file explorer?

你能在文件资源管理器中找到文件吗?

If you can, try to open the file through another explorer

如果可以,请尝试通过其他资源管理器打开文件

You can find your projects path by right clicking the project and hitting "File Path"

您可以通过右键单击项目并点击“文件路径”来找到您的项目路径

Is there local history available?

有本地历史吗?

Try right clicking the faulty file and checking Local History-> Show History

尝试右键单击错误文件并检查本地历史记录->显示历史记录

If you can fetch the local history, right click the history entry and click revert

如果您可以获取本地历史记录,请右键单击历史记录条目并单击还原

回答by Bachiri Taoufiq Abderrahman

you can go to VCS>Local History>show Historyand find from which Hour/minute you want to revert and hit revert. I've done this before and it saved my life.

您可以转到VCS>Local History>show History并找到要恢复的小时/分钟并点击恢复。我以前做过这个,它救了我的命。

回答by Raz Tourgman

If the file is not exists anymore, create a new file with the exact same name then try to use VCS-> Local History-> show History.

如果该文件不再存在,请创建一个具有完全相同名称的新文件,然后尝试使用 VCS-> Local History-> show History。

This was the only way works for me for a new file that was saved correctly/deleted.

对于正确保存/删除的新文件,这是对我有用的唯一方法。