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? :(
In my case I was looking for the file named 'landing_page222.java' which I deleted one day back.
Following Steps can help you to find your previously deleted files in Android Studio.
Step 1: Right Click on the folder where you deleted the file
Step 2: Find option for Local History and Click Show History.
Step 3: Find your File from Given List.
Hopefully it will be available in Instance
Step 4: Copy the code back as per need.
You can try:
looking for those files in the file system (perhaps they are still in your Android Studio projects folder)
looking in your OS's temp folder
using Android Studio's history feature (right-click on the Project tab > Local History > Show history)
Click whereever you want in the left frame (for example "drawable" file is ok) and then press CTRL+z. You are going to see "Undo delete popup" window.
And as you understand, when you press CTRL+z in Android Studio, which (XML or Java) file is active, you will undo the action on that tab. So, if you click any file on the left side and press the CTRL+z combination, you will undo the action at the file structure.
Go to View > Recent Changes > Click on the file you want to recover > Click "Revert"
Im late but this works. Go to the folder where u want to recover. right-click, local history. select ones you deleted and click revert. :)
Related
With other editors I used it was possible to see all local changes in a single diff window showing the unified diffs off all files one after the other, so if I changed 3 files for example then I could simply scroll through the changes in a single window without having to select the files separately for diffs.
Here's an example of what I mean from magit which shows all changes in a single window:
Is there a way to do this is Android studio?
Right-click on your project in project structure on the left.
then Local History -> Show History. If you want to show history only for src folder, click on it.. the same for layout folder etc..
It will open in one separate window and shows diff between changed and file before changes.
Try Version Control on the bottom left of Android Studio:
It lets you choose between the unified viewer and a side-by-side view:
I have created a few scratch files in android studio (fork of Intellij). by going to tools-->new scratch file.
But now i have soo many scratch files and i dont know how to delete them since they auto save. Can anyone help ?
Some info: scratch files are used to prototype code without it actually mingling with your exisiting code. Its like a notepad which auto saves.
To delete a scratch file or buffer, follow these steps:
Switch to the Scratches view of the Project tool window.
Under the Scratches pseudo-folder, right-click the scratch to be deleted, and choose Delete on the context menu.
Confirm deletion.
Source:
https://www.jetbrains.com/help/idea/15.0/scratches.html?origin=old_help#d640596e253
I was also able to do it by pressing cmd+E (for mac) to open the recent files popup. Then select the line and hit the delete key.
Switch to the Scratches view of the Project tool window.
Under the Scratches pseudo-folder, right-click the scratch to be deleted, and choose
Delete on the context menu.
Confirm deletion.
Is it possible to duplicate a file in Android Studio in the Project View?
When I right click on a file there I don't see it in any of the options.
If it's possible, how do you do it?
I don't know any direct shortcut to do it, but you can surely go with Ctrl+C, Ctrl+V. It'll open dialog similar to the following one:
To do this in one fewer step, select the file in project view, then press F5 or alternatively go to Refactor -> Copy. Works in Android Studio 3.3.2
I am unable to see the folders that are physically existing, this is the case.
But in actual fact I have other folders as welll
So what can I do?
Above your the file directory view in Android Studio is a drop down which currently is most likely set to Android. Change it to Project and you should be able to see all your files.
I tried the all the approaches mentioned above but can't fix rather than fix it by a hardcore approach -
Step 1. Close your Android studio.
Step 2. Delete .gradle and .idea folder from your project directory.
Step 3. Open your project and you will see the files again.
go to View menu then click tool window then after click on project
view->toolwindow->project
it worked for me
for me doing the following works:
from menu go to: View--->tool windows ---> Project
then click the little gears icon (settings) you will see an option to change the empty middle packages. it looks like this:
disable "Hide Empty Middle Packages" under the Project View settings dropdown and then it should make everything show up.
If anyone ever does what I did maybe this will help:
Android Studio does not like it when module names begin with a number. I was learning from some tutorials and named the first module "1-name" and the next one "2-name". Setup was fine and it ran, but only the "Gradle" Scripts entry would show in the navigation window in "Android" mode.
I have Visual Studio 2012 with TFS. I created a new file (call it "x.h") and before I checked it in I decided I didn't need it.
MSDN makes it sound so simple:
In either Solution Explorer or Source Control Explorer, browse to the folder or file that you want to delete.
Select the items that you want to delete, open their shortcut menu, and choose Delete.
When you are ready, check in your changes.
So I went to Source Control Explorer, right-clicked the file, and chose Delete. It was removed from source control and my pending changes but is still on disk and in the Solution Explorer. When I right-click the file in Solution Explorer, Delete is not an option and Exclude From Project is disabled.
I might have more luck if I check it in first then delete it but that seems very unnecessary. Hopefully I'm just missing something obvious!
How do I delete this new file ("x.h") from my solution?
Yep. It was something obvious.
You can't delete files from the Solution while it is building.
I just tried again and the Delete option magically reappeared. I realized that it has stopped a build since I last tried.
In short, there are three different angles that a user can try to delete a file while a build is occurring and the behavior is different for each.
Undo the file add from Pending Changes -> Nice error messages are given.
Delete the file from Source Control Explorer -> It lets you remove the file as I described in the question but leaves it on disk and in Solution Explorer (same behavior regardless of whether or not a build happening).
Delete the file from Solution Explorer -> It quietly prevents you from shooting yourself in the foot and doesn't explain why.
The right way to do this is to cancel the build (or let it complete), then delete from Source Control AND from Solution Explorer.