IntelliJ IDEA: the best IDE for programming Android?

Late last year the JetBrains team released IntelliJ IDEA 12, the latest version of its Java IDE.

Java today has many roles, but two dominate. One is server-side programming using one of many Java application servers, while the other is coding Android apps. IntelliJ IDEA has the former role well covered, though this is the first release with full support for Java 8, but Android development is less mature, though it seems to me that it has now come together.

The big new feature for Android is the inclusion of a visual user interface designer. Standard Android layouts are defined in XML, and the IntelliJ IDEA tool is a two-way designer that lets you flip between visual and code views. I found it to work well.

The starting point for an Android app is the New Project dialog. This hooks into the Android SDK installed on your machine. In this example I am using Android 4.1 “Jelly Bean”.

image

Next, you select a target device (actual or emulated) with the option to create a “Hello World” activity as a starting point. The project then opens in the IDE.

image

It is not obvious how to get from here to the new UI designer. The New dialog will not help you.

image

What you do is to hold down Control and click the word main in setContentView(R.layout.main).

image

The default layout is a LinearLayout. If you are making, for example, a calculator, you probably want a TableLayout or GridLayout. I found it useful to be able to flip between text and design views. The design view can save a lot of typing. The text view is excellent when you want to see the exact code and perform text operations like copy or search and replace.

image

I was surprised not to find an instant way to create an event handler (unless I missed it) but this is easily done in the editor. With IntelliJ IDEA, it is always worth pressing Alt-Enter as this will offer a prompt of potentially useful actions.

image

I hooked up an event listener and was able to set a breakpoint and debug my app:

image

Is this the best IDE for Android development? There is the mighty Eclipse of course; but while Eclipse can do most things, I am not surprised to see comments like this:

Usability: Intellij user experience is much easier to grasp. The learning curve in Intellij is by far faster. It seems using Intellij makes developing easier and more natural. Dropdowns, code completion, quick view, project wizards, etc, are all possible both in Eclipse and Intellij, but the experience in Intellij is much more satisfying.

That said, Eclipse is completely free, whereas the free Community Edition of IntelliJ IDEA has limitations – but as far as I can tell, Android support is included.

5 thoughts on “IntelliJ IDEA: the best IDE for programming Android?”

  1. I cannot comment on the Android stuff now. The Jetbrains IDEs fit perfect. Also the pricing schemes consider individual developers as well as corporates. IntelliJ is an amazing IDE in practice.

  2. I would guess that many developers coming to Android would prefer to wire the UI elements to event handlers using the second approach described here, rather than do it all in code the way IDEA apparently wants us to do it:

    http://developer.android.com/reference/android/widget/Button.html

    In fact, I would guess that assigning the event handler method name to the button’s onClick property (exactly as in Delphi et al) is the recommended way of doing it (the language here is the giveaway: “However, instead of”).

    Certainly JetBrains is not afraid of a challenge – in this case, to sell their IDE’s (IDEA, AppCode) when the standards for those platforms (Eclipse, Xcode) are free. Maybe using two IDE’s from the same root stock would make sense for some, but the IDE learning curve pales compared to the learning curve of the overall platform SDKs.

    While Eclipse might look like an IDE designed by a large committee, its somewhat disconnected approach does afford one advantage: Since building in Eclipse just means running a series of “builders”, it’s not too difficult to add build support for otherwise unsupported languages like Pascal:

    http://web.fastermac.net/~MacPgmr/pba/PbaStatus.html

    Thanks.

    -Phil

  3. @Phil that works too, and I don’t think IDEA has any preference one way or the other; it is all code. I suppose I was expecting some sort of right-click or double-click Add listener wizard but it is no big deal.

    Tim

  4. Sadly the world needs to develop something a little more complicated than calculator. At which point IntelliJ fails miserably (though its smarts are certainly appealing otherwise).

Comments are closed.