Configuring Android Studio

Intro

Android Studio has a cool feature to Import and Export settings. So during installation of new Android Studio version I usually import my previous settings. But recently a bad thing happened to me - I have lost my Android Studio settings file.

My advice to you: always keep backup of your Android Studio settings file somewhere on the cloud.

And since I am configuring my Android Studio from scratch anyway, below are some things which may be useful for you.

Show line numbers

When I first fired up Android Studio and started using it, one of the first things I wanted to do was to be able to see line numbers within the file. I was always curious why this thing is not turned on by default?

Without line numbers
With line numbers

To do so

  • In toolbar menu select File|Settings
  • Choose Editor|General|Appearance
  • Tick on Show line numbers
Settings

Camel humps

Android Studio doesn’t respect ‘Camel Humps’ words when you navigate through your code with pressed Ctrl+Left/Right arrow keys.

Without ‘Camel Humps’
With ‘Camel Humps’

To do so

  • In toolbar menu select File|Settings
  • Choose Editor|General|Smart Keys
  • Tick on Use ‘Camel Humps’ words
Settings

Note: if you still want to select whole word on mouse double click go to

  • In toolbar menu select File|Settings
  • Choose Editor|General
  • Remove tick on ‘Honor Camel Humps words settings when selecting on double click’

Field naming conventions

I am usually following field naming conventions from Android Code Style Guidelines for Contributors. There is one thing which Android Studio can automatically do for us - generate field name prefix for:

  • Non-public, non-static field names start with m.
  • Static field names start with s.
Field name prefix

To do so

  • In toolbar menu select File|Settings
  • Choose Editor|Code Style|Java
  • Select Code Generation tab
  • Add m prefix for field and s prefix for static field
Settings

Imports on the fly

In Android Studio there are shortcuts to auto import or clean-up non used imports. But we live in 2015 right? Those things should be done on the fly.

Without imports on the fly
With imports on the fly

To do so

  • In toolbar menu select File|Settings
  • Choose Editor|General|Auto Import
  • Tick on Optimize imports on the fly
  • Tick on Add unambiguous imports on the fly
Settings

Android log colors

With default Darcula theme Logcat highlighting I am not able to recognize type of log.

Darcula theme Logcat highlighting

I prefer to use bright colors from plain old Android Holo theme.

Holo theme Logcat highlighting

To do so

  • In toolbar menu select File|Settings
  • Choose Editor|Colors & Fonts|Android Logcat
  • Change all colors to ‘Holo’

Holo theme colors

출처 : https://medium.com/google-developer-experts/configuring-android-studio-4aa4f54f1153#.h25pwwsfd

 

Posted by outliers
,