Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Resetting Changes to Default Code Style

I'm here today because I'm having an issue with Android Studio. I don't know if it existed on previous versions (I don't remember this being an issue, so I doubt it was a problem on a previous version), but currently I am using the Android Studio V2.1 Stable release.

My issue is that if I launch Android Studio (I happen to be on Windows, 64-bit Android Studio) and at the Start Screen/Page, I click Configure>Settings>Editor>Code Styles, and change the default parameters on any of the languages (XML, Java, HTML, etc.), the Default profile is copied to a new profile (Default(1)) and the new settings get applied to each profile.

If I Apply these changes and exit Android Studio, and launch back up and follow the same method...the settings have completely gone back to what they were before I changed them, with the exception of the Default(1) copy profile. But from my experience, Android Studio doesn't build new projects based on this Default(1) copy profile, it builds them on the Default profile. Which means all of my adjustments to using indents and not spaces, keeping indents on empty lines, etc. all do not get carried through to the actual project files, leaving me to have to go back into the settings with the project loaded up and change all of these parameters again. That's just asinine. Please tell me I'm missing something here and that there's a simpler way of achieving the ability to keep a code style template that I can use on all of my projects!

Perhaps it would be better to report or consult on this using the Android Studio feedback site. If that's the better option, I'm willing to do that too.

Thanks everyone!

like image 217
Nathan Blair Avatar asked Apr 27 '16 06:04

Nathan Blair


People also ask

What is reformat code in Android Studio?

After opening the file we have to simply press the shortcut key as Ctrl+Alt+L to reformat the code in your file. With this key, the code in your file will be rearranged according to the code standards.


1 Answers

What I do in that case is

  1. Go to Preferences
  2. Code Style
  3. Select scheme you want
  4. Click Settings cog
  5. Click copy to project

Some OKs and then it works. enter image description here

like image 198
svkaka Avatar answered Sep 28 '22 03:09

svkaka