Android Studio에서 사용하지 않는 가져 오기 제거
최근에 Android 앱을 만들기 위해 Android Studio IDE를 시작했습니다. Android Studio에서 사용하지 않는 가져 오기를 제거하는 Ctrl단축키 가 작동하지 않습니다 ( + Shift+ O)
Android Studio에서 바로 가기 키란 무엇입니까?
Android Studio에서 프로젝트를 마우스 오른쪽 버튼으로 클릭 한 다음 작동해야하는 최적화 가져 오기 를 클릭하십시오 .
최신 정보
위에서 설명한 것과 동일한 작업을 수행하기 위해 Ctrl+ Alt+를 누르면 동일한 작업을 수행 할 수 O있습니다. 현재 파일의 가져 오기를 최적화하고 전체 프로젝트는 대화 상자의 선택에 따라 다릅니다.
당신은 즉시 그것을 할 수 있습니다. 매번 ( Ctrl+ Shift+ O) 또는 "프로젝트 가져 오기 / 최적화 ..." 를 호출 할 필요는 없습니다 .
이 확인란을 Settings
-> Editor
-> General
-> Auto Import
->로 설정하십시오 Optimize Imports on the fly
.
OSX에서 : Preferences
-> Editor
-> General
-> Auto Import
->Optimize imports on the fly
Ctrl+ Alt+를 누릅니다 O.
몇 가지 옵션이있는 대화 상자가 나타납니다. 원하는 경우 나중에 기본 동작을 설정하여 대화 상자가 다시 나타나지 않도록 선택할 수 있습니다.
가져 오기를 즉시 최적화하기위한 Android Studio (1.4) 설정도 있습니다 : 설정-> 편집기-> 일반-> 자동 가져 오기를 참조하십시오.
답이 늦어서 죄송합니다 .. Mac 사용자의 경우 Control + Alt / option + o 시도해보십시오.
Ctrl+ Alt+ O는 잘 작동하며 사용하지 않는 수입품을 제거합니다
Mac에서 사용 control + option + O
I think Ctrl + Alt + O works when the import is unused but a valid import. However, say you try to import a class from a package that does not exist or no longer exists (which can happen during refactoring), the shortcut command does not work (atleast it didn't for me). If you have more than one file like this, things can get problematic.
To solve this problem, click on Analyse -> Inspect code -> (select your module / project). Let it perform the analysis. Go down to Imports -> Unused imports. Click on the "Delete unnecessary import" button that appears on the right.
you can use Alt + Enter in Android Studio as Shortcut Key
Press Alt + Enter with the cursor on top of the import. The Optimize imports menu will show. Press Enter again. Your unused imports will be removed.
Android Studio 3 이상부터는 "가져 오기 최적화"옵션을 열면됩니다.
Alt+ Enter"가져 오기 최적화"를 선택하십시오.
사용하지 않는 가져 오기를 제거하기에 충분해야합니다.
참고 URL : https://stackoverflow.com/questions/22273434/remove-unused-imports-in-android-studio
'Programing' 카테고리의 다른 글
로그인시 ssh-agent 시작 (0) | 2020.04.21 |
---|---|
높이가 100 % 인 전체 화면 iframe (0) | 2020.04.21 |
자바 객체 대 객체 매핑을위한 도구? (0) | 2020.04.21 |
API를 구현할 때 블록에서 자체 캡처를 피하려면 어떻게해야합니까? (0) | 2020.04.21 |
파일 또는 어셈블리 'Newtonsoft.Json, Version = 4.5.0.0, Culture = neutral, PublicKeyToken = 30ad4fe6b2a6aeed'를로드 할 수 없습니다 (0) | 2020.04.21 |