4 minutes

Google's Gift: Android Studio

Android Studio insights by Dmytro Danylyk, Lemberg’s Android Developer.

Written by a big fan of IntelliJ IDEA, this topic will cover Android Studio features that have not been integrated into the latest IntelliJ IDEA 12.1.3.

Please note, it is just an EARLY ACCESS PREVIEW and it’s not recommended to immediately switch and develop applications on the new IDE.

  • You can download Android Studio here.
  • Read this for IntelliJ IDEA and Android Studio FAQs.
  • For common issues, follow Stack Overflow android-studio tag.

First off, a huge sigh of relief to all the Android community, as Eclipse will not longer misbehave. Android Studio is one of the greatest gifts from Google, and it is completely free. Thanks for that, you rock!

Now, let’s have a look at my favourite cool new features:

Android DDMS:

 Google's Gift: Android Studio - Lemberg Solutions Blog

Android DDMS now has three new icons:

  • Screen Capture
  • Terminate Application
  • Initiate GC

Screen Capture now allows us to create screenshots inside the frame with shadow and screen glare. You can also zoom in/out, see the output image dimensions and size:

Google's Gift: Android Studio - Lemberg Solutions Blog

The new Resource Directory now has a set of predefined values:

Google's Gift: Android Studio - Lemberg Solutions BlogGoogle's Gift: Android Studio - Lemberg Solutions Blog


The Layout Preview Screen now has All Screen Sizes/Locales preview. Also, one can quickly create another version of this layout (for example, landscape version).

Google's Gift: Android Studio - Lemberg Solutions Blog

One of my favorite features which I was missing in IntelliJ IDEA 12.1.3 has been now added to Android Studio. This is how Code navigation from Preview looks like. When you click on any view element in the Preview section, it will automatically navigate and highlight xml code. This is very handy and with big layouts.

Google's Gift: Android Studio - Lemberg Solutions Blog

The Palette panel now shows deprecated view and description:

Google's Gift: Android Studio - Lemberg Solutions Blog

Also, when you click on the custom view / fragment buttons, a dialog with list of available options pops up:

Google's Gift: Android Studio - Lemberg Solutions Blog

String Folding enables you to hide string id and show it’s value. Works in xml and java code as well:

  • Expand Ctrl + NumPad +
  • Collapse Ctrl + NumPad -

Google's Gift: Android Studio - Lemberg Solutions Blog

Google's Gift: Android Studio - Lemberg Solutions Blog

Inject Language helps you track a piece of code as a specific language for autocomplete and validation. And in case of regexp, you will have additional feature to check it inside a small dialog preview.
Ctrl + Enter:

Google's Gift: Android Studio - Lemberg Solutions Blog

Quick Documentation: Ctrl + Q. This is definitely a killer feature. If you call quick documentation on a drawable resource file, it shows preview of images from all folders.

Google's Gift: Android Studio - Lemberg Solutions Blog

Quick documentation on a dimension file gives you a list from all folders:

Google's Gift: Android Studio - Lemberg Solutions Blog

If you have strings translated to other languages, quick documentation will show them as well:

Google's Gift: Android Studio - Lemberg Solutions Blog

The other thing that was added is Rendering Problem Help. For example, if you have a view without layout_width or layout_height, it prompts you to add missing attributes:

Google's Gift: Android Studio - Lemberg Solutions Blog

Annotations is another killer feature, in my opinion. They come as a separate jar file. What does it bring to us?

  • Highlight method which may produce NullPointerException.

Google's Gift: Android Studio - Lemberg Solutions Blog

  • In parameters you can now see @NotNull annotation which means arguments can’t be null.

Google's Gift: Android Studio - Lemberg Solutions Blog

  • If you put a wrong constant value as a method parameter, it is not only highlighted as wrong, but it also displays a list of correct ones.

Google's Gift: Android Studio - Lemberg Solutions Blog

Gradle

This calls for a separate blog article, which I’ll be working on now. To see why, check out Gradle User Guide and Gradle Plugin User Guide.


Here are some useful tips that I’ve found while surfing the net

  • First, it wouldn't install. Not finding Java JDK even though it was installed.

This is solved by changing the name of C:\Windows\System32\Java.exe to something else before the installation.
Don't forget to change it back to java.exe once it is installed.

  • After installing Android studio, it wouldn't run (normal or admin didn't change a thing).

You will need to create a system environment variable named JDK_HOME with your JDK installation path (in my case C:\Program Files\Java\jdk1.7.0_21\ ). Android studio should now launch. (more help here)

  • Now when Android Studio launches, it asks for the latest android SDK

Just download and install the SDK 22 from http://developer.android.com/sdk/index.html

Do not import Android Eclipse projects into the Studio. Instead, use ADT 22 to export your project to Gradle and import that in Studio.

About Lemberg

Lemberg is a UK mobile and web development company with strong client base in the UK, Europe, and the USA.

Starting from 2007, Lemberg has been helping leading design and marketing agencies, start-ups, innovative businesses deliver brilliant digital solutions for a number of the world’s biggest brands.

We provide our clients with impeccable services, including mobile apps creation (iPhone, iPad, Android, Windows Phone), web development (Drupal, front-end, back-end and API development), and support services.

Our goal is to go beyond clients’ expectations: as a technology partner, we take the responsibility for implementing the most ambitious, creative and innovative ideas.

Article Contents: