Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio code formatting slow and scrolls down

When I just started using Android studio I had no issues with code formatting. Then out of nowhere the code formatting just stopped being nice to me. No matter the file size (usually takes longer in larger sized files) it takes a couple seconds on a super fast computer with a large heap, and about a minute on a laptop. To make matters worse, the code scrolls almost all the way to the bottom making me lose my spot.

I've made a gif explaining what happens. I format the code using a shortcut at the beginning of the gif.

gif or gifv (faster)

Edit:

Specs:

  • Android studio v1.1.0 x64 with an 8gb heap size
  • Latest version of JDK 7 (JDK 8 does the same thing)
  • Disabled all VCS plugins without luck
  • Checked all formatting options with no luck

Computer Specs:

  • 32gb 1800mhz ram
  • SSD
  • i7 3.7ghz

My computer is on the high end size and I've never had any problems except for this.

Edit 2:

I'm taking pictures of my formatting options maybe there's something I'm missing.

  • Tabs and Indents
  • Spaces Page 1 - Page 2
  • Wrapping and Braces Page 1 - Page 2
  • Blank Lines
  • JavaDoc
  • Imports
  • Arrangement
  • Code Generation

Edit: Still same behavior after many updates. Tried different computers, different projects, clean install, always the same issue, why is no one else complaining??? I format a lot and it's slowing down my workflow substantially.

like image 802
Andres S Avatar asked Nov 09 '22 17:11

Andres S


1 Answers

I have not found the solution to this kind of problem but I can at least tell you that a complete, and I mean complete, re-install of everything has fixed my issue. I had to re-do all my settings and formatting settings but I had to do it to fix this dumb issue.

If someone stumbles across this issue this is what I deleted: (for windows)

  • Delete your .android, .androidstudio, .androidstudioxx (any version changes), from your User folder.
  • Also delete any remnants of gradle.
  • Inside your user/local folder delete your android sdk.
  • Completely uninstall android studio making sure that everything is gone.
  • I also deleted my .idea folder from my project and had Android studio rebuild everything. Make sure you leave the IML files so that everything can be rebuilt without annoyances.

Basically I removed every remnant possible of gradle, android studio, and android from my computer except for my code, gradle build files, and the IML files. Then reinstalled everything and re-did the settings BY HAND (don't import your settings because it's probably what broke stuff in the first place).

I really wish I could have figured out what the problem is so it doesn't happen again but I went months with this issue and it slowed me down a lot. I just needed to get back on track. If someone from the Android team is reading this, with the kindest words that I could muster up, don't make a broken IDE your official one. Eclipse was extremely stable (with very few annoyances), fast, and reliable.

like image 66
Andres S Avatar answered Jan 04 '23 03:01

Andres S