Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android studio disable optimising imports automatically

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.

like image 712
Hariharan Ayyasamy Avatar asked Feb 10 '16 15:02

Hariharan Ayyasamy


People also ask

How do I disable wildcard imports?

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.

What does optimize imports do Android studio?

Adds a menu item to optimize imports across the whole project with the possibility to restrict the files by scope and/or file mask.

How do I turn off auto import in IntelliJ?

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.

What does optimize imports do?

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.


2 Answers

Try to disable:

File | Settings | Editor | General | Auto Import | Optimize imports on the fly.

like image 96
rain_ Avatar answered Sep 19 '22 18:09

rain_


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

like image 34
MRX Avatar answered Sep 17 '22 18:09

MRX