For some unknown reason, I can’t edit files in Android Studio. This includes both Java and XML files.
When I launch Android Studio (v1.2.2), everything is fine. However, after some time, I lose the ability to edit files content. Here is what I noticed:
- When I click on any line in the source code, the lines get highlighted but the caret indicator is not showing.
- When I start typing, a
search for:box starts appearing on the top of the left panel (Project window), and it starts filtering the project files according to what I type!
- Files are not locked as Read-Only. I checked.
- Restarting Android Studio did not resolve it permanently. Everything seems fine for some time, then the problem appears again.
- I did check my keyboard to see if I have a stucked keystroke that might cause this problem. Didn’t notice anything.
- In the Project window, I noticed that
MainActivityfile name is in grey (See the screenshot below). I’m not sure if this is because of something I did, or if it is how Android Studio identifies the main Activity in the project.
This appears to be that the Code view loses focus to the Project view. That’s why I can’t edit the code and the search box appears: because The focus is with the Project view, permanently.
I couldn’t find a permanent solution. However, by accident, I found a workaround that is less annoying than restarting Android Studio:
When you lose focus to the Project view, click on the far right of the Code View, where the scrollbar exist.
I tried to figure out what causes the Project View to steal the focus permanently but I couldn’t. Until someone do, this will be the accepted answer.
Answered By – iTurki
Answer Checked By – Timothy Miller (Easybugfix Admin)