Shortcut to Auto Import all in Android Studio

Android Studio provide great facility to create application in Android. But when I try to paste some code copied from Internet in Editor, it ask me to import every Views and classes. You can simply import all of them by pressing ALT + ENTER key. It is very tedious work to import each and every component by pressing ALT + ENTER.

But, what if I want to import library and all other classes at once. I found a solution for that.

Go to File -> Settings -> Editor -> Auto Import -> Java

make the following changes:

  • change Insert imports on paste value to All from Drop Down menu
  • Add unambigious imports on the fly option as checked

Now, click on APPLY and OK to save changes.

This will auto import all the classes when you PASTE any code in editor.