Getting started with Android development in IntelliJ IDEA
Before you install IntelliJ IDEA 12 and proceed to writing your first hello-world Android application, there are a couple of things to check:
- The latest Java SDK is installed;
- The Android SDK is installed;
Paths to both SDKs are requested during the setup of IntelliJ IDEA and must be known anyway before you can successfully compile and deploy a sample application.
1. Download and install the Java SDK
You can get the latest Java SDK from the Oracle’s web site.
2. Download and install the Android SDK
You get the Android Development Tools (ADT) bundle from the Google’s web site.
Note that the official download page for Android presents various options for download.
The default ADT bundle for Windows, as well as for other platforms, includes Eclipse and the Android plugin. If you plan to use IntelliJ IDEA as your Android IDE, then you might want to opt for a smaller download and just pick up the Android SDK and platform tools.
Downloading the Android SDK alone
By simply scrolling down the web page in the figure above, you can find specific instructions for getting the Android SDK to use with an existing IDE for a variety of software platforms, as in the figure below.
Once you have successfully downloaded the Android SDK for the platform of choice, you unzip it in a folder or just run the installer, if any. For the Windows platform, you find a convenient installer. As first thing the installer checks if the Java SDK is installed.
Next, you indicate the destination folder of the Android SDK files and proceeds with installation. Take a note of the installation path as IntelliJ IDEA needs to know about it to successfully compile your applications.
3. Configure Android platforms
Right after the successful completion of the setup wizard, the Android SDK is still not complete. It does contain all basic SDK tools, but it doesn’t contain any platform specific tooling. In brief, it is not fully configured to let you build applications within IntelliJ IDEA or any other IDE.
Using the SDK Manager
As there are quite a few different Android platforms out there (e.g., Android 2.2, Android 3.0, Android 4.0 and so forth). You need to install binaries and tools for each of the platforms you intend to build applications for.
The final step of the Android setup wizard, however, just offers to launch the tool that walks you through the selection of the Android platforms of choice.
Through the SDK Manager you select the Android platforms of choice and the tool downloads all necessary files and samples. The figure below shows the SDK Manager tool in action. You select the platforms you are interested in and click Install packages to install related packages.
You can launch SDK Manager at any time. However, you need to launch the SDK Manager at least once before you can successfully compile a single Android application.
You can add new platforms at any time by simply launching the SDK Manager from the installation folder. You use the SDK Manager tool also to uninstall one or more Android packages.
4. Download and install IntelliJ IDEA