44

I am trying to add a layout to an Android project:

Right clicked on res folder New | Directory. The directory was created however not shown under app/res. Maybe because empty dirs are hidden by default? Went to Windows explorer and added a file to the newly created directory (hidden in Android Studio). Back in the Studio, how can I 'refresh' the project structure to show the newly created directory and the file under it?

Essentially my question is, what is the alternative to Eclipse' Refresh menu option?

2
  • 2
    This shouldn't be happening. Have you tried exploring your project via the different options (above your project you have the options for Android, Packages, and Project. One of the other views may give you what you want. Commented Feb 6, 2015 at 21:04
  • @zgc7009 Correct! The 'Structure' view is what I needed. Commented Feb 6, 2015 at 21:07

5 Answers 5

38

If I find that Android Studio is out of synch with the file system I use File->Synchronize. Or equivalently, Ctrl+Alt+Y or the little circle with arrows menu button.

Sign up to request clarification or add additional context in comments.

3 Comments

If this doesn't work you can try File > Invalidate Caches and Restart which will rebuild the project index
Also, if you find a way to avoid using the OS's file system and instead add files/directories from within Android Studio, you might reduce the likelihood of needing to do the rather time consuming Invalidate Caches and Restart
It looks as if this has been renamed 'Reload All From Disk'.
13

In the case of device files - right click on the directory in question in the Device File Explorer and click on 'Synchronize'

1 Comment

It looks as if this has been renamed 'Reload From Disk'.
5

There is a view option right on top of the hierarchy folders (see attachment). Select "Packages"

Screenshot of project menu in Android Studio]

Comments

1

Mac

Cmd+fn+F9

Windows

Ctrl+F9

2 Comments

Note: this is just a shortcut to build
And linux is not an operating system?
0

Seems to be, in Android Studio Chipmunk 2021.2.1 at least:

  • 'File->Synchronize' refreshes project expolers Project view correctly
  • BUT it doesn't refresh the Android view. 'File->Invalidate caches and restart' refreshed this view for me. View is selectable from the drop down list up in the project explorer frame.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.