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.
Disable wildcard importsIn the Settings/Preferences dialog ( Ctrl+Alt+S ), select Editor | Code Style | Java | Imports. Make sure that the Use single class import option is enabled.
Adds a menu item to optimize imports across the whole project with the possibility to restrict the files by scope and/or file mask.
You can disable auto-import on completion and use quick-fixes instead: In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | General | Auto Import. On the Auto Import page that opens, use the checkboxes in the TypeScript/JavaScript area to enable or disable import generation on code completion.
Quickly remove any unused imports and more. With the Optimize imports action (Ctrl+Alt+O), you can quickly remove any unused imports, merge imports from the same module, and optionally sort the import statements.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With