Wednesday, May 29, 2013

Build Android Apps with Intellij IDEA

I am always amazed when I see devs still using Eclipse for Android or PhoneGap development. Yes, I understand that it is free, but so is Intellij IDEA's Community Edition, and it blows Eclipse away in every way you can measure. In fact, my favorite announcement of Google IO 2013, is that Google is going to switch from Eclipse to the Intellij based Android Studio for future Android development. See, I am not the only one who thinks this is a great IDE. Also, don't be fooled by the Android Developer Tools, ADT, it is simply a Google customized version of Eclipse. 

While I think it is no more difficult to install than Eclipse, it is usually the prerequisites that throw people off. So here are all of the instructions I could think of to install it on a Windows machine. For you Mac and Linux users, the basic steps except the USB Driver part, also applies to you. When I get a chance, I will write the instructions for Mac.

I've even included the instructions for installing a USB driver for an Android device. If you want to developer PhoneGap/Cordova apps for Android never fear, at the top of this post is a link to those instructions as well.

Download Java SE Development Kit 6 (NOT 8 or 7)

Don't freak out here. This is an old version of Java and yes the security warnings are scary, but they don't really apply to Java running on Android. 

Scroll down the page until you find the Java SE 6u45
Accept the license agreement
Click the download link for your system

Accept the license agreement
Download the proper package for your system
You don't need the documents or samples
Install the package
Validate the install by going to command window or terminal 
type "java --version"

The system should respond "java version 1.6.0_45"

Set the JAVA_HOME environmental variable
Windows Start
Right click "Computer"

Click "Properties"

Click Advanced system settings

Click Environment Variables
Under System variables
Click New...
In Variable name: enter - "JAVA_HOME"
In Variable value: enter - "C:\Program Files\Java\jdk1.6.0_45" or where ever you installed Java

Keep clicking OK until you've closed all of the dialog boxes

Install Android Developer Tools (not the bundle)

Install the package just for me (NOT Install for anyone using this computer)

Install Android SDK Manager stuff

Install the default packages (API 19)
Windows user need the USB drivers if you want to deploy to a device
Accept the license
Install the Android USB Driver (only needed if deploying to an Android device)
Connect your Android-powered device to your computer's USB port.
Right-click on Computer from your desktop or Windows Explorer, and select Manage.
Select Devices in the left pane.

Locate and expand Other device in the right pane.
Right-click the device name (such as Nexus S) and select Update Driver Software. This will
launch the Hardware Update Wizard

Select Browse my computer for driver software and click Next.

Click Browse and locate the USB driver folder. (The Google USB Driver is located in <sdk>\extras\google\usb_driver\.)

Click Next to install the driver.

Install Intellij IDE Community Edition

Click the "Download Community" button on the right
Install Intellij IDEA