Search Everywhere not working fine in Android Studio 3

Viewed 6157

Search Everywhere is not working fine in Android Studio 3. When I type anything, it doesn't show up. Take a look at screenshot below, typed AndroidManifest but no result.

If I look for any layout file, it shows file reference in R.layout file.

Searching for a layout file and getting results from R file.

Searching for AndroidManifest and its asking to create a new file :/

EDIT:

Ctrl + Shift + N doesn't work as well.

enter image description here

Tried restarting AS but no luck.

4 Answers

Go to File -> Invalidate Caches / Restart...

Once you have restarted the search index will be rebuilt.

Search in Android Studio is not reliable. Since so much programming really needs searching to work and work EVERY TIME (and since invalidating caches and restarting is NOT AN OPTION for each time you need to search) I have the following old-school but reliable solution:

grep

Make sure your working directory is the base directory of your project. Type:

grep -r 'pattern' .

  • To make it case insensitive, add "-i" to the command.
  • You can add a file pattern with "--include [file_pattern]", such as --include "*.java" or --include "*.xml" to speed things up.
  • You can pipe the results into a file or the less command, where you can then search the search results, ;)

And the best part? It Works!

Search Everywhere shows "Recent Files" if the files have not been opened recently then they will not show up in search. Open all your files (you can open 10 at a time by selecting and pressing Enter key) and close all. This will index them all in recent files and then you can use search everywhere.

Not sure how time is calculated for "Recency".

A better way to search for file is go to Navigate->File (by this way you can search for any file). You can note the shortcut written next to it (depending on if you are using Mac or Windows).

For me it works neither. The search everywhere function is broken for me, at least, it does not search everywhere (no full text search). I can literally paste a line of code of a file open in android studio, into the search everywhere box and it does not return the file that is open in front of me.

The find in files (ctrl + shift + f) function searches text / source files for the string and gives the expected result.

Related