Mobile Zone is brought to you in partnership with:

Co-founder of MiQUiDO company creating innovative mobile apps for business and entertainment. Many years of experience in server-side application development, management and consulting. Krzysztof has posted 1 posts at DZone. You can read more from them at their website. View Full User Profile

Intellij IDEA 12 Android Support Review

04.22.2013
| 5406 views |
  • submit to reddit
In this article I would like to share with you a review of Android development support in Intellij IDEA 12 Community Edition. I switched to this IDE from Eclipse some time ago and found it a good alternative to consider for Android development.

Below you can find a list of features with quick review of each of them.

Code Assistance

Code Assistance works very well in the code, as well as in resource files. The editor provides smart completion, which can quickly generate the most of code, e.g. for anonymous internal classes. Castig to desired object is very easy: just start typing:

ClassA a = ()

then position the caret inside brackets and press Ctrl+Shift+Space, Code Assist will fill-in class name automatically.

Adding on-click listener as an anonymous class is also very quick:

Smart completion fills-in all the boilerplate code, all you need is to fill method implementations.

In resources file, the code completion features work also very smoothly:

There is also a quick-fix feature enabling user to quickly create missing resources when referencing them or add missing methods while implementing interface or extending a class.

Built-in Lint checks for Android

As of 11.1 version of Intellij IDEA, Android Lint tool is integrated so IDE provides you with Lint warnings directly when editing layout files:




Quick navigation between classes and resources

Navigation between Classes, interfaces and resources is consistent and intuitive. Just Ctrl+Click on a reference and IDE will open appropriate string resource, asking you when there are more possibilities (like different languages).

UI Designer – available from Intellij IDEA 12

As of Intellij IDEA 12, a graphical layouts designer is included. This is the feature that was available in Eclipse before, but in Intellij it was missing until the latest major version. I've played with the designer a little, the generated layout code is pretty clean, based on RelativeLayouts and specifying appropriate margins of elements.

Anyway, I'm not a fan of graphical design tools, so I usually deep directly to the XML source of layout files and make changes there. But I agree that for simple layouts it's faster to build them using designer than to create them from scratch in the XML code.



UI Preview on different device screens

As I wrote before, I'm not a fan of graphical design tools, but what I really like in Intellij, is that I can quickly see how my changes of XML layout or style files affects the UI without the need of launching the application after every change. You can quickly check how the layout looks on different screen sizes, Android versions, screen orientations, locales, in day-time or night-time and applying different themes.

I found this feature really helpful and saving a lot of time.

Powerful refactoring tools

Refactoring support is the feature that makes Intellij IDEA much more productive tool than its competitors. Comparing to Eclipse, it's much more powerful and easy to use. When I was using Eclipse, I was afraid of using refactoring tools, as it usually caused some problems and I had to solve them manually. In Intellij, refactoring is easy and safe. I'm not talking about easy refactoring techniques like name change or extracting methods, but more complicated ones, like package structure changing or pulling-up methods to upper classes.

Logcat logs access

Similarly to Eclipse, Intellij contains Logcat console, on which you can analyze Logcat output of your app or Android system. It allows to create and save custom filters which helps to distinguish interesting information from tons of logs that Logcat produces.

Integrated Android Tools

Some of Android SDK tools, like draw9patch, ddms, AVD Manager and SDK Manager are accessible directly from IDE, so you don't need to switch the window when you want to edit 9-patch file or update Android SDK Tools.

Running and debugging applications on devices and emulators

You can deploy, run and debug Android applications either in emulator or on a real device. Intellij provides you with possibility of saving many running configurations, so it's easy to run application on different emulator or real devices with one-click command.

Debugger provides developer with all needed functionalities like breakpoints, evaluating expressions on the fly, watches, smart stepping into methods and other features. You can also seamlessly connect to remote devices over network (e.g. while testing GoogleTV app) and debug the application directly on them.

Annotations processing support

It is pretty easy to configure Intellij IDEA to use annotations processor, like AndroidAnnotiations. This framework helps a lot in reducing amount of code needed for Android application and makes the code more readable.

To enable annotations processing, it is enough to open Settings, go to section Compiler → Annotations Processors, check “Enable annotation processing” and provide a path to annotations processor.

Summary

To sum up, Intellij IDEA provides you with several really helpful tools that make Android applications development much easier and productive. That's why after a while of testing it, I didn't want to switch back to Eclipse IDE.

Community Edition is completely free even for commercial purposes, so we've decided to use it in our company as a standard Android IDE. It's definitely worth to give it a try if you think seriously about Android development.

Published at DZone with permission of its author, Krzysztof Biga.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)