Best Ways to Recover Deleted Files/Projects in Android Studio

menu_default hide_default

avatarStack Overflow Community

I'm working on an app at the moment, and one of the final steps was to get it built and signed in Android studio. Unfortunately I was having some problems, and one of the recommended solutions was to remove the project and start again, however when I did this it took all of my files with it, and they're not in the trash (OSX) either. Is there anyway to recover these files, or are they lost forever? :(

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.

recover deleted files in android studio

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, 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 view to Android in the left part of the Android Studio, 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).

    recover deleted files in android studio
  • Step 3. Find the version you desire there, right-click it and choose Revert selection.

  • 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

  • recent changes
  • Step 2. Select the Deleted File. Click Revert. And just like that, your file is back!

Restore Deleted Projects in Android Studio

If you accidentally deleted your whole project folder in Android Studio and dont know how to retrieve it. Try these:

Firstly, create a new project with same name and same package name. Then, try to create new files with the same names as your deleted files. After that right-click the project folder and select Local History > Show History.  Fortunately, Android Studio keeps track of all changes. This will help you.

Recover Your Android Studio Deleted Files with AnyRecover Easily

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.

As a professional data recovery program, AnyRecover should be able to handle any lingering issues with your deleted files. If you don't have any backup, it is the last way for you to retrieve the files and back to work in Android Studio ASAP.

You're in luck! There is no need to shell out a fortune for getting your precious files back on your first go. Any Recover offers a free trial for up to 8 files recovery without any size limitation.

Anyrecover Data Recovery

Features of AnyRecover:

  • High recovery rate ensured by the combination of all-round and deep scan features.
  • 100% safe recovery due to the program not overwriting existing data in the process.
  • Support over 1000 different file formats of documents(XML), photos, videos, and emails, etc.
  • Recovers from all the complex file loss scenarios, whether the files have been deleted, corrupted, affected by virus, or are the victim of a lost partition.
  • It is compatible with almost every type of storage devices - From internal and external HDDs and SSD's to USB drives and digital cameras.
  • Supports both Windows and macOS - Windows 11/10/8/8.1/7/XP; macOS 10.15, OS X 10.14, 10.13, 10.12, 10.11, 10.10.

Okay, now how do you use it? Well, that's simple, especially since it can solve your current or first batch of problems with the free trial.

Step 1 Download and launch AnyRecover. Select which drive your missing files were in. You can go through multiple drives, but for now, select the drive you think is most likely to contain your lost files.

select location

Step 2 After selecting the specific location, the program will begin searching for lost files.

start scan

Step 3 After the scan, a list of lost files will appear. From there you can double-click on the file to preview it before selecting the Recover buttom.

scanned files preview

How to Change Local History Retention Period in Android Studio

The Local History is configured by default to store revisions for the last 5 working days (the days on which the file was modified).

  • Press Ctrl+Shift+A in your keyboard. You can choose Help | Find Action from the main menu instead. Type in Registry in the popup window. Next, select the corresponding item and press Enter.

  • In the Registry editor, locate the localHistory.daysToKeep key and change its value.

  • Click Close and restart Android Studio for the changes to take effect.

By configuring JVM options, you can pass the localHistory.daysToKeep parameter as a Java property. To set retention to 30 days, Follow the step below:

Add the line DlocalHistory.daysToKeep=30 into the JVM options file.

However, if you want to disable Local History completely, change the retention period to 0.

In Conclusion

The only piece of preventative advice that would be to get into a habit of backing up windows consistently. It never hurts to have a backup to fall back on in the worst of cases. That is the end of any chastising we might offer as these problems happen to anyone. We hope that the solutions above has assisted you in restoring, recovering, or reverting deleted files in Android Studio. At the very least, you now have a tool in your belt. AnyRecover can be a powerful tool when it comes to recovering any types of files you might lose.
user

By Greyson Cyrus , to PC Data Recovery

Updated: Sep 16, 2021