Search code examples
androidcode-formatting

How to prevent AndroidStudio from formatting custom line breaks?


AndroidStudio formats custom line breaks. Version: Dolphin | 2021.3.1

What I've tried


I tried to disable this function by unchecking "Line breaks" checkbox at AndroidStudio> Preferences> Editor> Code Style> Java> Wrapping and braces> Keep when reformatting.

But the problem remained unsolved.


Solution

  • I finally figured it out.


    Step 1 Uncheck "Line breaks" at AndroidStudio> Settings> Editor> Code Style> Java> Wrapping and braces> Keep when reformatting>

    Step 2 Uncheck "Reformat again to remove custom line breaks" at AndroidStudio> Settings> Editor> Code Style> Formatter>