In the development process, as the project iterations, the file part of the import may have been unused, for this useless import, we can not one file deletion. Here is a feature that automatically deletes unused import.
first, the development environment:Android Studio 1.5
Ii. Methods/Steps
1. Start Android Studio, open the project, and you can see that the Java file has an extra import,
2. Click "Code" in the menu,
3.
Re-select the submenu "Optimize Imports ...".
3.1 The unused import in the current file is automatically deleted when "Optimize Imports ..." is selected, since the current file is selected.
3.2
After deleting the file,
4. The above operation, in fact, you can select the files to be manipulated, right-click, in the Display menu also has "Optimize Imports ..." Options.
5. If the folder is selected, a dialog box will pop up when "Optimize Imports ..." is selected. In the dialog box, you can choose to delete the extra import only for files modified within the current folder;
5.1. Click the "Run" button to start deleting the unused import operation for the files in the current folder. 6. If you want to perform an optimized import of all Java files in the directory, you can select the directory you want to apply in the Project window and execute the previous process.
Android Studio automatically removes excess import