Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search Everywhere not working fine in Android Studio 3

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.

like image 910
Noman Rafique Avatar asked Nov 06 '17 10:11

Noman Rafique


2 Answers

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

Once you have restarted the search index will be rebuilt.

like image 108
Victor Rendina Avatar answered Nov 13 '22 21:11

Victor Rendina


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!

like image 36
SMBiggs Avatar answered Nov 13 '22 23:11

SMBiggs