Skip to content

Instantly share code, notes, and snippets.

@mxkmn
Last active October 5, 2024 19:26
Show Gist options
  • Save mxkmn/e1794e9f0b5d472a6055a71a33170771 to your computer and use it in GitHub Desktop.
Save mxkmn/e1794e9f0b5d472a6055a71a33170771 to your computer and use it in GitHub Desktop.
Android Studio Configuration

Android Studio Configuration

This tip is created to allow quick setup of the IDE when a complete data reset is required due to problems.

Plugins

  1. Android Drawable Preview
  2. Case conversion
  3. Code::Stats (if used) (type Code Stats in search bar)
  4. Grazie Lite
  5. Kotlin Multiplatform Mobile (if used)
  6. Napalmpapalam Dark Theme
  7. Rainbow Brackets Lite - Free and OpenSource
  8. Statistic

Settings

Enable

  1. Appearance & Behavior | Appearance | Compact mode
  2. Appearance & Behavior | Appearance | Tree Views | Show indent guides, Use smaller indents
  3. Editor | General | Soft-wrap these files
  4. Editor | General | Auto Import | unambiguous imports
  5. Editor | General | Editor Tabs | Show pinned tabs in a separate row, Enable preview tab
  6. Advanced Settings | Enable experimental Multiplatform IDE features (if KMP is used)

Disable

  1. Appearance & Behavior | Appearance | Smooth scrolling, Use project colors in main toolbar
  2. Editor | General | Editor Tabs | File icon, extension
  3. Other Settings | Rainbow Brackets Lite | indent guides

Change

  1. Appearance & Behavior | System Settings | Open project in new window, Default project directory
  2. Editor | General | Editor Tabs | Multiple rows
  3. Editor | General | Editor Tabs | Close button position | None
  4. Editor | General | Editor Tabs | Tab limit | 100
  5. Editor | General | Editor Tabs | tab on the right
  6. Editor | Code Style | Kotlin | Use tab, Tab size 2, Indent 2
  7. Editor | Natural Languages | Russian
  8. Advanced Settings | Terminal scrollback buffer size | 50000
  9. Other Settings | Code::Stats | API key

Keymap (shortcuts)

  • Alt+Left as Back (Ctrl+Alt+Left)
  • Alt+Right as Forward (Ctrl+Alt+Right)
  • Alt+R as Rename (Shift+F6)
  • Alt+F as Reformat Code (Ctrl+Alt+L)
  • Alt+C for Convert Case
  • Ctrl+Shift+T for Reopen Closed Tab (keep other shortcuts)

Live templates

AndroidCompose:

  • valContext | val context = LocalContext.current | Kotlin -> Expression

Custom actions

Firstly, add to %APPDATA%/Google/AndroidStudio_._/tools/External Tools.xml:

<toolSet name="External Tools">
  <tool name="Run Ktlint" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
    <exec>
      <option name="COMMAND" value="$ProjectFileDir$\gradlew.bat" />
      <option name="PARAMETERS" value="formatKotlin" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>
  <tool name="Run Detekt" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
    <exec>
      <option name="COMMAND" value="$ProjectFileDir$\gradlew.bat" />
      <option name="PARAMETERS" value="detekt --continue" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>
  <tool name="ADB: Kill server" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
    <exec>
      <option name="COMMAND" value="adb" />
      <option name="PARAMETERS" value="kill-server" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>
  <tool name="ADB: Devices" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
    <exec>
      <option name="COMMAND" value="adb" />
      <option name="PARAMETERS" value="devices" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>
  <tool name="ADB: IP connect .26:5555" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
    <exec>
      <option name="COMMAND" value="adb" />
      <option name="PARAMETERS" value="connect 192.168.0.26:5555" />
      <option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
    </exec>
  </tool>
</toolSet>

Then, add actions to the toolbar with icons:

  • ADB: Devices: Select Multiple Devices...
  • ADB: IP connect .26:5555: Pair Devices Using Wi-Fi
  • ADB: Kill server: Delete...
  • Run Ktlint: Auto Arrange
  • Run Detekt: AskStudioBotAction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment