Skip to content

Instantly share code, notes, and snippets.

@mxkmn
Last active June 27, 2024 09:48
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 | Use smaller indents in trees
  2. Appearance & Behavior | New UI | Compact mode
  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

Shortcuts

  • Alt+Left as Ctrl+Alt+Left (Back)
  • Alt+Right as Ctrl+Alt+Right (Forward)
  • Alt+R as Shift+F6 (Rename)
  • Alt+F as Ctrl+Alt+L (Reformat Code)
  • 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 kill-server: External Tool (delete)
  • ADB devices: Default icon
  • ADB IP connect .26:5555: Pair Devices Using Wi-Fi
  • Run Ktlint: External Tool (new UI)
  • Run Detekt: Select File in Project View
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment