2

I am following the basic tutorials in the Android Developer official site. And there's a part that I cant get to work.

The instruction said if you want to import the missing class just use ALT + ENTER on the top part of the class.

When I do that it wont import the missing classes. Instead its just viewing the Create Test option only.

I'm new in Android development I hope you can help me.

Jerielle
  • 7,144
  • 29
  • 98
  • 164
  • Just check this http://stackoverflow.com/questions/22272524/how-to-auto-import-the-necessary-classes-in-android-studio-with-shortcut – Gueorgui Obregon Feb 03 '16 at 01:04
  • Please check this link [AUTO IMPORT ON FLY](http://stackoverflow.com/questions/16615038/what-is-the-shortcut-to-auto-import-all-in-android-studio) – jazzbpn Jan 22 '17 at 05:38

1 Answers1

6

Auto import will only work if the missing class in question is underlined. So if you see a class in red, click on the screen somewhere close to the class to adjust the cursor position and then try ALT + ENTER once the class name is underlined.

Another option is to auto complete when typing the class name (which can be accomplished via ENTER or TAB, sorry muscle memory makes me forget which...) This will automatically import the appropriate class.

If you are using a third party library and this isn't appearing properly, make sure you add a compile statement for that library in your gradle build file.

Heinrich Cloete
  • 702
  • 5
  • 12
CodyEngel
  • 1,501
  • 14
  • 22
  • Ok thanks. I remembered I changed my import into `auto import`. So If my setting is in `auto import` is it still necessary to use `ALT + ENTER` command to import missing classes? By the way there are no red lines in my code. So I think its fine and the other is in `variable never used` – Jerielle Feb 03 '16 at 01:09
  • Can you attach a screenshot of your screen? I'm not sure I understand what your issue is. – CodyEngel Feb 03 '16 at 01:14