Copy intellij-java-google-style.xml into the directory $HOME/Library/Preferences/IdeaIC14/codestyles/.

Answer from passerby4j on Stack Overflow
🌐
Metova
metova.com › home › recent articles › how to import the official android code style
How to Import the Official Android Code Style - Metova
July 15, 2024 - Save it to ~/Library/Preferences/AndroidStudioBeta/codestyles. Hidden files and folders will need to be visible to do this.
🌐
Medium
medium.com › @ramrai11501 › how-to-set-a-custom-code-style-in-android-studio-eb5cdd4e24b8
How to set a custom code style in Android Studio - zephyr - Medium
October 6, 2021 - The steps to set this custom code style file in Android Studio is as follows: ... 3. Click on the settings icon to the right of the “Scheme” label at the top and select “Import Scheme” from the drop-down.
🌐
GitHub
github.com › grandcentrix › AndroidCodeStyle
GitHub - GCX-HCI/grandcentrix-AndroidCodeStyle: Android code style settings for Android Studio at grandcentrix
Code formatting rules for Android Studio · Based on googles java code style (https://git.io/v5XuB) Hungarian Notation (m-Prefix) No star imports except for testing libraries · Increase the line length to 118 (default 100) android:id after xmlns declaration in XML layouts ·
Starred by 218 users
Forked by 62 users
Languages: Shell 100.0% | Shell 100.0%
🌐
GitHub
github.com › openMF › Fineract-CN-mobile › wiki › Importing-Android-Code-Style-in-Android-Studio
Importing Android Code Style in Android Studio
Here are steps to import the guidelines in the android studio. ... For Mac Users 👍 Save it to ~/Library/Preferences/AndroidStudioBeta/codestyles.
Author: openMF
🌐
GitHub
github.com › square › java-code-styles › issues › 39
How to add coding style in android · Issue #39 · square/java-code-styles
April 28, 2017 - Restart IntelliJ and/or AndroidStudio, go to preferences, and apply 'Square' or 'SquareAndroid'. jsroyal@HP:~/java-code-styles-master$
Author: square
🌐
Medium
medium.com › @amitkma › maintaining-code-style-for-android-app-e7bf99f3b409
Maintaining Code Style for Android App | by Amit Kumar | Medium
May 14, 2017 - If you don’t know how to add style to your project in android studio, follow this link — How to Import The Official Android Code Style.
Find elsewhere
🌐
Android By Code
androidbycode.wordpress.com › 2015 › 02 › 14 › applying-the-aosp-coding-style-in-android-studio
Applying the AOSP Coding Style in Android Studio | Android By Code
February 21, 2015 - Grab the xml code styles definitions for the Intellij platform. These can be downloaded from the AOSP source, or for easy access from a GitHub mirror. Step 2: Add the definitions file to your Android codestyles folder · You need to move this file within your .AndroidStudio configuration folder on your machine. The exact location will vary not only between operating systems, but also Android Studio versions.
Top answer
1 of 2
4

I've done quite a lot of researches, but in the end, I haven't reached a very satisfying answer: probably it's just a code style for IntelliJ.

The first thing I did was trying to compare the IntelliJ style with something else, but I always found some differences.

It doesn't follow Google's style because they don't fully qualify import, in fact, IntelliJ will try to unify imports by putting *, like writing import foo.*; instead of import foo.Bar;.

It doesn't follow Oracle's guidelines either since the switch statement is formatted in a different way:

switch (condition) {
    case IDEA:
        statements;
        break;
case ORACLE:
    statements;
    break;
}

At this point, I've started looking for something else, but found even less. In fact, IntelliJ doesn't tell about the code style used in their software anywhere. Instead, they just explain how to change it.

Moreover, there are plugins for every possible code style! If one of them was the actual style in IDEA a plugin shouldn't be needed...

To make things worse, even for Kotlin, a language created by IntelliJ, they differentiate between "Kotlin Coding Conventions" and "IntelliJ IDEA default code style".

What I think is that they made a code style that works for most languages supported by their IDEs with little differences, and this is what Android Studio ended up using by default.

2 of 2
0

Android Studio code styles are based on IntelliJ Idea code styles. You can refer this link to know more about code styles in IntelliJ Idea

Code Style Java

Also you can refer this link to customise your code styles,

Android Studio Code Style

🌐
CommonsWare
commonsware.com › Jetpack › pages › chap-settings-004.html
Code Styles
Code style handles everything from how big is a tab to whether wildcard imports (import android.widget.*) are allowed. Android Studio offers per-language code style configuration, such as for Kotlin:
🌐
GitHub
gist.github.com › makotokw › 5873665
Code Style for Android Studio https://android.googlesource.com/platform/development/+/87cfafaa3d9ebebe6a60d7919fe6b4dfb62a7bf0/ide/intellij/codestyles/AndroidStyle.xml · GitHub
Code Style for Android Studio https://android.googlesource.com/platform/development/+/87cfafaa3d9ebebe6a60d7919fe6b4dfb62a7bf0/ide/intellij/codestyles/AndroidStyle.xml - AndroidStyle.xml
🌐
Android Open Source Project
source.android.com › docs › core › architecture › hidl › code-style
Code style guide | Android Open Source Project
June 17, 2026 - The HIDL code style resembles C++ code in the Android framework, with 4-space indents and mixed-case filenames. Package declarations, imports, and docstrings are similar to those in Java, with slight modifications.