Introduction to Android Application Development Part 3: Installing Android 2.0 SDK on a Mac

June 10, 2010 20 Comments

Here’s a repost of an earlier blog post for everyone at the Humanities Gaming Institute.

Lately I’ve updated to Android 2.0 SDK.  In the process I noticed that things were slightly different.  Following my motto of “Scratching my head so you don’t have to,” I’ve decided to document the new process of installing the SDK from scratch.  (And I mean from scratch… I just freshly installed Mac OSX yesterday.)

System Details:
Here are some details on my system so you know what environment I’m working in:

Picture 1

Essentially I’m running a white MacBook about a year and a half old… Theoretically this install should work with any Mac.

Step 1: Get Eclipse
If you already have eclipse feel free to skip this step, but I was serious about documenting the process from scratch…

Download the version of Eclipse for your purposes at http://www.eclipse.org/downloads/.  I download the Eclipse IDE for Java Developers because I mostly use Eclipse for Android development.  Under this header I choose the Mac Cocoa 32 bit download, as the Carbon download is soon to be deprecated.

Picture 2

Unzip the downloded tar.gz file somewhere convenient.  I just unzipped it to my ‘Documents’ folder.  Inside this folder there is an eclipse executable with the familiar eclipse logo.  (I just add eclipse to my dock items afterwards so I don’t have to hunt for it again.
Picture 3
Step 2: Download the Android SDK

Grab the Android SDK from the Android website.  Choose the proper SDK for your environment (which would be Mac OSX) and download.  Unzip this to an appropriate place as well.  Again I just dump it to my documents folder.

Step 3: (Optional but highly recommended) Add /tools to you $PATH variable

Now to make your life easier if you ever plan on doing anything remotely involved with android, add the /tools directory within the SDK folder to your $PATH variable.  This allows you to easily invoke the tools found in the folder, such as adb quickly from a terminal window.
To edit your path variable:

  1. Open a terminal window
  2. Edit your .bash_profile file (its ok if this doesn’t exist yet.  I just edit by nano .bash_profile
    )
  3. Add export PATH=${PATH}:<your_sdk_dir>/tools to the open file.  I usually make sure i get this right by popping open another terminal window and cd-ing until I’m in the /tools directory, typing pwd and copying and pasting the results.  My .bash_profile file now reads: export PATH=${PATH}:/Users/myusername/Documents/android-sdk-mac/tools
  4. Save and close.  To do this with nano use <ctrl>+<x> , <y>, <enter>
  5. To test whether your $PATH variable has changed, close all terminal windows, open a new one and type in $PATH.  Something like -bash: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/usernamehere/Documents/android-sdk-mac/tools: No such file or directory should appear.

Step 4: Install the Eclipse Plugin
Now we have to install the Eclipse plugin for Android development

  1. Open Eclipse
  2. Goto Help > Install New Software
  3. Click Add
  4. In the resulting popup box type Android ADT Plugin (or something similar) into the name field
  5. Type https://dl-ssl.google.com/android/eclipse/ into the Location field
  6. Press OK
  7. Check the box next to ‘Developer Tools’Picture 4
  8. Click Next.
  9. Accept the liscense agreememts
  10. Click Finish

At this point, the plugin should install.  After installation Eclipse will prompt you to restart it.

Step 5: Adding SDK Components
Here’s where things are different.  Instead of installing the SDK for a given version of Android, we now install SDK Components for that version of Android.  This allows us to test against many different versions of Android easily and make sure that that prized application we’ve worked on for the past several months works on Android 1.5, 1.6, 2.0, and over 9,000

  1. Open the preferences pane.  This can be done easily by the keyboard shortcut <cmnd> + <,>.
  2. Click Android on the left pane as shown below
    Picture 5
  3. In the field SDK Location fill in the directory where you unzipped the SDK
  4. Click Apply then Ok
  5. Go to Window > Android SDK and AVD Manager
    Picture 6
  6. Goto Available Packages, check the box next to the website listed, and check the components you want to install.  Click Install Selected. Accept all and Install. This will be how you install new Android versions.

Now you should be ready to go and start developing Android applications!  If you have any trouble following anything listed above, leave a comment and I’ll help remedy the situation.

Add to Del.cio.us RSS Feed Add to Technorati Favorites Stumble It! Digg It!
    www.sajithmr.com

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
Sphere: Related Content

Programming
20 Comments to “Introduction to Android Application Development Part 3: Installing Android 2.0 SDK on a Mac”
  1. [...] The following instructions assume you’ve downloaded and installed the Android SDK, and added the /tools directory to your system’s $PATH variable.  For instructions on how to do this, see my earlier post Installing Android 2.0 SDK on a Mac. [...]

  2. [...] The following instructions assume you’ve downloaded and installed the Android SDK, and added the /tools directory to your system’s $PATH variable.  For instructions on how to do this, see my earlier post Installing Android 2.0 SDK on a Mac. [...]

  3. Patrick says:

    Awsome but I still dont understand the .bash_profile   part

    • The .bash_profile part is so that you can easily execute commands from the terminal to your phone. If you add the /tools/ directory of the SDK to your $PATH variable, this allows you to be able to just type adb to execute a command on your phone. Which part don’t you understand? Essentially the process involves opening a terminal, editing a system file, and restarting the terminal to make sure everything worked out fine…

  4. Patrick says:

    Sorry wouldnt allow me to re reply but basically everything im just learning to code i got my droid yesturday and wanted to try it out thanks for the help!

    • Here are the steps you’re going to take:

      1. Open a terminal window
      2. type nano .bash_profile
      3. add export PATH=${PATH}:/Users/myusername/Documents/android-sdk-mac/tools to that file.  Replace myusername with your username on your mac.
      4. Type <ctrl>+x, y, enter to save and close the file.
      5. Restart your terminal window
      6. type $PATH
      7. The directory of the /tools/ folder should be the last directory listed.

      Let me know if this helps…
  5. Patrick says:

    I get this /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin: No such file or directoryand i did this nano .bash_profileexport PATH=${PATH}:/Users/RileyPhoto/Droid/android-sdk-mac_86/tools<ctrl>+x, y,  “SAVED “OVERWROTE” BUT DID NOT CLOSE”"I closed terminali typed $PATHAnd got /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin: No such file or directory

  6. Patrick says:

    patrick-rileys-imac:~ RileyPhoto$ cat .bash_profilecat: .bash_profile: No such file or directorypatrick-rileys-imac:~ RileyPhoto$ .bash_profile-bash: .bash_profile: command not foundpatrick-rileys-imac:~ RileyPhoto$

  7. Patrick says:

    the ya isnt part of it

  8. Cerys says:

    Ok so I’ve done all the steps listed except the path variable one.I don’t have a clue what I’m doing there so thought I’d best not mess this up.Correct me if I’m wrong, but I still don’t see how this means I will have Android 2.0 on my G1…there’s nothing about how to get this on the phone.I’ve previously rooted to Cupcake and there were parts were I had to install update.zip files…maybe I’m missing something entirely but if someone could help me out that would be great. my email: cerys_mt@hotmail.co.ukThanks!

  9. Cerys says:

    Okay now I’ve done the path variable bit and seen the links at the bottom of the post but both are broken. If someone could email me the next steps I’d be super grateful. My Macbooks currently downloading all the SDK Platforms so I need the steps from there i.e. connecting the phone and getting it on 2.0Thanks

  10. [...] Installing Android 2.0 SDK upon the Mac | DroidWeb [...]

  11. [...] eclipse to take screenshots of your phone. I published an article on how to install the SDK here: Installing Android 2.0 SDK on a Mac | DroidWeb. Let me know if you need any help __________________ Looking for app ideas to work on ===== [...]

  12. Avi says:

    Thanks man. It would be great if you could add the simulator start from the AVD too. It makes people happy to see that android is running =D

  13. Ian Owens says:

    Your PATH explanation helped me out greatly. Thanks for the superb write up and attn. to details! Warmest regards.

Leave a Reply


Spam Protection by WP-SpamFree

Droidtip: Install e-mailed .apk files via tAttachApkInstaller

Ever received an .apk attachment via gmail?  As an application reviewer, I most certainly have. For the longest I’ve wished...

Protect your Android Device with Stealth Guards. For Free.

Here’s a limited time offer all you Android phone owners should jump on quickly. StealthGaurds.com is offering its...

TweetDeck for Android is Arriving and its Amazing!

If there’s one area that has no clear winner yet for Android, its Twitter apps.  We have seen apps...

Nexus One Revived as Next Android Developers Phone

In the (not so) recent news, Google announced the discontinuation of the Nexus One.  For many Android fans, this...

Android Development Made Simpler with Droid-fu

android,progrmaming When you program for Android you find yourself doing some of the same tasks repeatedly. As a programmer you know...