I recently blogged on the Android SDK and my initial experience.  Since, I’ve received several requests to outline the steps required to get started.  That is, to install, configure and debug an Android application.  This 2 part series intends to do just that.

Where We Are Going

This post will focus on downloading, installing and validating your Android development configuration on Windows.  It is the first step when getting started.

Step 1: Download

First things, first.  Download the required installation files to your local hard drive.  Once everything has completed downloading, continue to step 2.  Keep in mind, my recommendation is different than the instructions you’ll find on the official Android developers website.  This is because I find the following configuration provides the most robust developer experience when working with Java EE, GlassFish and Android.

JDK 6 Update 17 1.6.0_17 is the latest.  I recommend you download the 4th item down titled “JDK 6 Update 17”.  You don’t need any of the bundles. Download Here
Netbeans IDE 6.7.1 This version comes bundled with the GlassFish application server.  Not required for Android development, but you’ll be glad you have it.  You’ll see. Download Here
Android SDK r3 Direct link for Android SDK. Download Here

Step 2: Installation

Rather than give you a play by play, I’m only going to highlight the most important sections for each installation.  For the most part, it should be fairly straight forward.

1. Install the JDK.  Run the downloaded installer.

NOTE: You must install the JDK first.  Netbeans requires the JDK to be installed prior to installation.

2. Install Netbeans but choose “Customize” and remove GlassFish Server v2.1 and Apache Tomcat 6.0.18.  Here is a screenshot of the options I installed.

image

3. Extract the Android SDK.  I recommend you place the root sdk folder named “android-sdk-windows” into the root of C:.  For example, I extracted the files to “C:\android-sdk-windows”.  Then run “SDK Setup” in the root folder. Here is a screenshot of the packages I’ve installed.  Leave the Android SDK setup open.  We will continue with some configuration in the next step.

image

4. Click on “Virtual Devices” and create at least one runtime device.  I created two.  One that targets the core Android 2.0 platform and one that targets Android 2.0 and the Google APIs.  Once your devices are created, you can exit the Android SDK setup/configuration utility.

image

Step 3: Configuration

Now that we have all the core requirements installed, we need to take a few more steps and update our Netbeans IDE with the Android development plug-in.  The plug-in gives us native access to all Android development functions including template projects, elements and integration with the Android emulator.

1. Start Netbeans and navigate to “Help->Check for Updates”.  Install any available updates.  (Restart Netbeans if prompted.)

2.  Next, we are going to install the Android plug-in.  Navigate to “Tools->Plugins->Settings” and add a new update center.  This will provide a new update center where the Android development plug-in for Netbeans will be installed from.

Update Center URL:  http://kenai.com/downloads/nbandroid/updates.xml

image

3. Once you’ve added the update center, navigate over to the “Available Plugins” tab.  Type “Android” in the search box.  This will limit the list of available plug-ins.  Choose the Android plug-in and all sub items.  Then, click “Install”.

image

Step 4: Create and Run an Android App

OK, are you still with me?  If you’ve made it this far then don’t give up now.  Let’s create our first Android application.

1.  Start Netbeans if it isn’t already started.

2.  Navigate to  “File->Project” and choose “Android->Android Application”.  Select “Next” and take the defaults on the next screen.  NOTE: When you get to the second screen, you may need to choose “Manage Platforms” if no platforms are listed.  If so, use Manage Platforms to add a new Android platform.

image

image

3. Once you complete the wizard, the project explorer will populate with the structure of an Android project.  Let’s run it!

4. Click the Debug Main Project toolbar item or “Ctrl + F5” to start debugging.  Choose the Android platform and then choose OK.  NOTE:  The emulator will start quickly but it may take a minute or so to load your app in the emulator.  Be patient!

image

5. Your screen will look like the following once the emulator is finished loading.  Unlock the device and your application will load.

image The emulator will look like this once loaded.
image Your application running in the emulator!

Summary

Congratulations!  I hope you stuck it out and successfully installed and configured what I consider a sweet Java EE and Android development setup.

In Part 2, I’ll explain how to decrease debugging time by leveraging a physical Droid device and bypassing the emulator.  I’ll also explain why I chose the Netbeans/GlassFish bundle and how to write web services for GlassFish that can be consumed by Internet connected Android devices.

Share this post
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • StumbleUpon
  • Facebook
  • Twitter
  • email