I had a few unused imports in Java file which were not used. Android Studio suggested me to "Optimize unused imports automatically on the fly" I clicked on it.
Now all the unused imports are removed automatically. Is there a way to revert this settings?
I am new to android so please forgive me if i missed something simple.
Try to disable:
File | Settings | Editor | General | Auto Import | Optimize imports on the fly.
File > Settings > Editor > General >Auto Import (Mac: Android Studio > Preferences > Editor > General >Auto Import).
Uncheck check boxes and set Insert imports on paste to None. Unambiguous imports are now added automatically to your files.
Reference