Switching to IntelliJ

Developing in Android is an activity that is done in Eclipse the majority of time, after all Google supports the Android Developer Tool (ADT) for the platform which makes development a breeze with one exception: you are still using Eclipse.

Now don’t get me wrong, I don’t mind Eclipse, in fact when it comes to trying out a new language I can almost always be assured that a plugin exists and I get to play in an IDE that I am familiar.  But, I have always found then when I start getting into serious development and heavy coding Eclipse falls short, especially with respect to performance.  I think it tries to be “a jack of all trades, master of none.”, perhaps the most frustrating aspect is the intelli-sense support; I come from .NET where Visual Studio is bar none the best IDE one can work in, perhaps my standards are just too high.

Luckily JetBrains, the same company which produces my favorite refactoring tool ReSharper, saw this shortcoming as well and created IntelliJ and, as luck would have it, due to the popularity of Android they began integrating Android supporting into their IDE, which is available for free via the Community Edition, though I am considering buying the full, if only to support the development, might serve as my official non Mono/.NET development IDE.

When I first started exploring this, the integration was still not all there, it is now.  The only thing really missing that Eclipse has is the management of external resources (SDKs, Emulator) through AVD built right into the IDE, IntelliJ does not.  However, managing this content can easily be accomplished by running the android.bat file in your tools directory where you store your SDK libraries on your machine (below)androidbat

This aside you can do everything in IntelliJ, and the performance of the development aid tools are just so much better.  If you are starting with a fresh install on a system devoid of Android, hit up http://developer.android.com/sdk/installing.html and skip step 1 and 3 (and any others referring to Eclipse or ADT).

The Android plugin will still come bundled with the Community Edition, which you can download here.  It will automatically read your system for Android SDKs installed, so be prepared to point to these SDKs (in other words, know where you installed them).

One of the early complaints that I had was the inability to switch which SDK I was using on the fly.  Its not at all common for this to happen due to the rapid proliferation of Android and the decision of what features you want your apps to use.

Simply right click your project and select Module Settings.  Select the Dependencies tab and press “Add”, you will see the following:ModuleSettings

In my case, I have all version of Android since 1.6 installed, excluding 3.0.  1.6 is NOT in the list cause the project is currently using it.  From this dialog you can easily Add/Remove the SDKs your project is using.

Selecting the Emulator is equally as easy, you simply need to add configurations:EditConfigurations

Notice, when you first enter this mode the dropdown shown above will be empty, so you will only have “Edit Configurations”.  The screen is pretty self explanatory, hit the indicated plus button to add configurations.Configurations

The square indicates the button to add to add a new launch configuration.  I tend to create a new launch configuration for each project which allows me to easily control different version requirements for my apps.  You can of course share the configuration across multiple apps.

Also on the screen, indicated by the arrow, you can select the emulator profile you wish to use.  These are created using the AVD Manager which we launched using the android.bat file above.  The above is my naming convention describing the emulators OS version and resolution.

All in all, I have really enjoyed using IntelliJ for my Android editing.  The only real obstacle I ran into was the way to support a two project solution from Eclipse; the answers is multiple modules, though getting everything in IntelliJ is a bit tricky.  But despite the minor friction points because you have to do a bit more to get things working then Eclipse, development is an absolute dream, especially the intelli-sense aspect.

I do not plan to cease recommending Eclipse for beginners, but my Advanced Android talk that I will be debuting at the Chicago Code Camp on May 14, 2011 will feature IntelliJ as my IDE of choice.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s