Shortcut alt+enter is not working in Android Studio - android-studio

alt + enterfor importing was work normally maybe until I updated Android Studio,
my version now is2.3.3
as this screenshot, I can't press alt + enter at all, knowing that I have tested them on other programs and they are working normally

Use LEFT Alt Key + Enter. It works well in Android Studio 3.0.1.

I encountered the same problem today, this is how I solved it.
Go to File > Settings > Editor > General > Auto Import
Uncheck and Check Show Import Popup
Do Invalidate caches and Restart of Android Studio. (If this option doesn't work, restart your computer
Edit
Another solution I've found to work is to uninstall Android Studio and reinstall it.

Try "the Windows Key + Alt + Enter" if you are using windows.
It feels weird as I am pretty sure my keyboard works fine and android studio settings are alright, but I just see the pop-up suggestion for class import and nothing happens when I press Alt+Enter.
I work on Windows 10 and my Android SDK is on a different hard drive(E:) from the Android Studio installation(C:), not sure if these contribute to the problem.
After some trial and error I accidentally solved the problem by pressing "the Windows Key + Alt + Enter" to conjure the import class menu and could then press Enter again to properly import the suggested class.

In the Android studio Settings/Keymap "shortcut Ctrl+Alt+S"
search for usage of "Alt + Ent" as below image if its not assigned for any action plz go for No. 2
In the Android studio Settings/Editor/Intentions.
Check whatever you want to show Intention in are checked or not as below photo
Double check no.1 is working fine and you found usage of "Alt + Ent" shortcut
[You can find the solution on official Jet brains website]
Intellij IDEA keyboard shortcuts
Intention actions

I faced the same problem and was sure that the problem is in Android Studio. But when I reinstalled it I realized that it did not helped. So I decided to test my keyboard. I found that my left Alt is not working with Enter and right Alt somewhy is turning on Ctrl key. That is why Alt+Enter was not working in any combinations. Problem was solved by reinstalling keyboard driver. Hope it will helps somebody.

Go to File and Unchecked Power Save mode.

For Windows/Linux, you can go to File -> Settings -> Editor -> General -> Auto Import -> Java and make the following changes:
change Insert imports on paste value to All if ask or none to All
markAdd unambigious imports on the fly option as checked
On a Mac, do the same thing in Android Studio -> Preferences

If someone encounters this issue nowadays, for me it was the language change on the keyboard. I must have made some weird keyboard combination that changed the language, therefore ALT + ENTER was not really doing I was thinking it should do. Switching it back to ENG made it work correctly. Cheers.

in Android Studio 3.2.1, the Alt + Enter combination key is only used on the left side of the keyboard.
If you want to use the Alt to the right, it should be manually selected from the section
Settings> Keymap> other
Right-click on the row
show intention action
select add keyboard shortcut
Press Alt (Right) + Enter
I hope this helps

it was the problem with the latest version to...instead of pressing alt+enter. use ctr+o it will open a dialog box then select the method u want to implement and then click on ok button ..its works with all version of android studio.. { Happy coding ;) }

I thought I had the same issue and none of the above fixed the problem. I thought I was using Alt+Enter for Parameter info. Now I use Ctrl+p I get the parameter info for the widget. Not sure if this was changed from Alt+Enter to Ctrl+p but if looking in the File/Setting/Keymap it shows Ctrl+P.

I just ran into this and what worked is Alt+Insert combination

The first thing you have to check is did you put the code inside the onCreate function?
If not put it there and try again. the Alt+ Enter would work after that.

I encountered the same issue after I upgraded Ubuntu. Left Alt+Enter was working but more comfortable Right Alt+Enter did't. Resolved using this solution in AskUbuntu.
In case if you cannot open the link:
Open "Tweaks" (aka "Gnome Tweaks") go to "Keyboard & Mouse" -> "Additional Layout Options" -> "Key to choose the 3rd level" and put a check mark on "Right Alt never chooses 3rd level".

I faced the same problem. Then I found that I was typing the
public void functionName (View view) outside the class. Hence alt + enter did not work.
After I moved the function inside the class, alt + enter worked.
This is a silly mistake though.

In my case (v4.0.0) there was a plugin (CSV Plugin) blocking the shortcut alt + enter.
Generally speaking, my suggestion is to try deactivating all the plugins and see if then it works.

I just pressed alt + f4 to exit and pressed cancel just to check if alt key was working. Fortunately after that everything was working fine.

Go to 1)setting > 2)intensions > 3)checkmark (Dart) and it will work normally without any problem.

Related

Mouse scroll wheel causing text selection in VS code

I'm using VS code and by accident I pressed some keys and somehow the scroll wheel of the mouse is selecting text rather than scrolling the page up and down. I feel like the mouse wheel press is acting like pressing the "alt" key.
I've tried deleting VS code and deleting extensions and such and it didn't work.
The problem persists only in VS code.
Is that problem familiar to you?
Do you know how to fix that?
Thank you, Ori Silberman.
The only help I can give is to completely nuke your VS code, and all preferences and support files and start again.
The preferences and support files can be found as follows.
macOS:
~/Library/Application Support/Code
Windows:
%APPDATA%\Code\
Linux:
~/.config/Code/

shortcut to see all the properties of widget in flutter

I m new at flutter, I m using android studio and I want to know is there is any shortcut to see all the property of any particular widget at the time android studio it self, without going to the documentation page.pls help, it really help to reduce the development time.
In my case it's ctrl + space. But I'm not using apple's mac mini keyboard.
So "In my case" ctrl + space is the most useful. Then you can click on some widget e.g Text and press ctrl + j to see documentation. You can also press cmd + p to see all properties in inline mode.
This feature is called Code Completion:
On my MacbookPro & Android Studio Smart Code Completion -> fn+^+space was working. However Basic key shortcut ^+space was shadowed by MacOs keyboard input settings. So disabling the select the previous input source solved this shadowing. Now both shortcuts are working.
In Mac it's (control + J), if not working go to preferences or settings, then head to keymap, and then there search for documentation. you will get the shortcut.
Also try ( command + p ), I think that would work for what you are trying to find.

Copy-paste is not working in Android Studio on Mac

I am facing a weird issue with Mac version of Android Studio (i.e., I am not able to copy (⌘ + C) and paste (⌘ + V) any text). I have no idea why it is behaving strange like this. My question may be silly, but I have been facing this issue since I started working from Windows to Mac. Any solutions and alternatives would be much helpful for me. I am completely stuck with this issue for the past two days.
There are several reasons why you could be experiencing this
You are using ClipMenu and Android studio doesn't like it
Your keybinding is messed up.
To solve keybinding issue press File -> Settings and check what the keybindings are, you have maybe changed it or imported settings from somebody else. See the image as a reference.
Note: the filter of copy, you need to do this for paste too.
To fix the issue with ClipMenu.
Right click on "Application/IntelliJ IDEA 14.app"
choose "Show Package Contents"
edit bin/idea.properties
add this property ide.mac.useNativeClipboard=True
restart IntelliJ IDEA.
There is a YouTrack issue with further information
this worked for me
go to file menu and click on invalidate Caches/Restart ,after this confirm the dialog open .
Go to File-> Setting->Editor(Under IDE Settings)->Change value of maximum number of contents to keep in clipboard to 1(Under Limits section)
I have this issue due to PopClip I have to disable it to get the keyboard shortcuts working.
Check that your keymaps aren't messed up. Go to Android Studio > Preferences > Keymap > Main Menu > Edit. If copy and paste are set correctly there, then it must be something else in your system that's stopping it
I got this bug with my ClipMenu (on Mac) while set useNativeClipboard=true.
I solved the problem by using ClipMenu to paste file into Android Studio (show menu of ClipMenu, then select item)
In my case, the Ctrl c is occupied by other programs(my case is "Oulu Dictionary" program).
Try to check if other programs have global shortcut keys.
disable the plugin Ideavm if installed under settings>plugins>installed.

Close white cursor in Android Studio

In Android Studio, my cursor is white rectangle. I'm cannot write anything. And changed my keyboard button actions.
h-->left arrow j-->down arrow k--> up arrow l-->right arrow
How can I fix problem or can I reset Android Studio settings?
Just got the same problem as yours. And this is the solution:
Go to File > Settings > Editor > General > Appearance, then uncheck the Use block caret
Try fn + ins. That worked for me.
Go to settings and plugins and just disable the IdeaVim plugin it works in 2020.itx also occurs due to this extension.
In windows, win+insert worked for me.
Presse Fn+0. It will work instantly.
go to plugins and disable IdeaVim then restart android studio it will be ok ...
Press Fn + Del on your keyboard together.
Explanation: Its because Delete key on keyboard has Insert function. So pressing Del along with Fn key will enable Insert mode within your editor from Overwrite mode as in your case.
It's ins in the latest version of Android Studio.
In windows if you press INSERT key cursor mode will get change,use WINDOWS + INSERT to get back into normal mode
For mac users just right click and deselect "Column selection mode" or press Shift + Command + 8
Just restart Android Studio and voilà !
None of the other solutions worked for me (Windows 7, maybe with an inactive Lock Num key).

Remove unused imports in Android Studio

I recently started Android Studio IDE to make my android apps. I find shortkey to remove unused import in Android Studio is not working (Ctrl+Shift+O)
What is shortcut key to do same in Android Studio?
Simple, right click on your project in Android Studio, then click on the Optimize Imports that should work.
Update
To do same thing which I described above, you can do same just pressing Ctrl+Alt+O, it will optimize imports of your current file and your entire project depends on your selection in a dialog.
You can do it on the fly. You don't need to call (Ctrl+Shift+O) or "Project/Optimize Imports..." each time.
Just set this checkbox in Settings -> Editor -> General -> Auto Import -> Optimize Imports on the fly.
On OSX: Preferences -> Editor -> General -> Auto Import -> Optimize imports on the fly
Press Ctrl + Alt + O.
A dialog box will appear with a few options. You can choose to have the dialog box not appear again in the future if you wish, setting a default behavior.
It is very Simple Just Follow the below step.
Switch your project in Project Mode.
Then right-click on project name.
The final step is to select the Optimize imports from popup menu.
Enjoy!!
On Mac use control + option + O
Sorry for the late answer.. For mac users command + option + o
Try this.. It is working for me..
Ctrl+Alt+O works pretty well and removes unused imports
there is also an Android Studio (1.4) setting to optimze imports on the fly: see Settings->Editor->General->Auto Import.
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.
here Android Studio Chipmunk | 2021.2.1 Patch 1
windows 10
ctrl+alt+o
worked perfectly
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.
Since Android Studio 3+, this can be done by open the option "Optimize imports".
Alt+Enter the select "Optimize imports".
This must be enough to removed the unused imports.
On MacOS (Monterey) + Android Studio (Arctic Fox 2020.3.1):
To Remove unused imports, follow below procedures.
Android Studio -> Code -> Optimize Imports
Shortcut key: Option + Command + O
Please see screenshot for more clarification. Thanks.
Specifically for Flutter Just set this checkbox Settings -> Languages & Frameworks -> Flutter -> Organize imports on save
you can use Alt + Enter in Android Studio as Shortcut Key

Resources