You probably should have taken a break hours ago, but you are just so close! Then all of a sudden, you realize that a core section of your project is gone, and you cannot for the life of you remember how you did it. However, today we are going to focus more on the solutions to recover deleted files in Android Studio rather than pour salt on the wound. If you’re experiencing an accidental deletion in Android Studio or in any other IDE, keep reading.
How to Restore Deleted Files/Projects in Android Studio
When it comes to programming, accidents or data loss can happen all too often. Don’t worry, even if you can not find anything in the default trash can. Just follow the steps below, and restoring deleted files in Android Studio can become much easier.
Restore Deleted Files in Android Studio
Unlike version control systems that only track changes between commits, local history records your project’s revisions as you edit code, run tests, deploy applications, and so on. You can actually solve most of your issues from local history, which lets you restore deleted files, bring back separate changes, or roll back to any state of a file. If you messed up some features and need to get back to the previous version of the project, it is also the easiest way for you.
- Step 1. Switch the view to Android in the left part of the Android Studio, and right-click the class file (app node).
- Step 2. Move to Local History. Local History should be near the bottom of the list of options and shows the most recent changes that you have made to your programs. Click Show History.
You can select any folder in the browser and check the Local History (i.e. the app directory).
- Step 3. Find the version you desire there, right-click it and choose Revert selection.
Now, your whole project in Android Studio will be restored to the state you desire. Do not remember where the deleted file was housed? No need to worry! We have some more viable options for recovering those files. The key to this resides in the recent changes section. This method effectively helps you undo a deleted file in Android Studio.
- Step 1. Follow this Path: View > Recent Changes
- Step 2. Select the Deleted File. Click Revert. And just like that, your file is back!
Note: If you can’t find anything you desire in Local History and you local hard drives. In this situation, the only solution for you to restore the lost files in Android Studio is using the third party data recovery software.
This article was previously published on proandroiddev.com