Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Sunday, January 29, 2012

Android Development - Starters Guide (Updated for Android 4.0)

First things first, major appreciation goes out to Lars Vogel for his incredibly helpful tutorial on Android development.  The last time I tinkered with all this, the best (only) online resources available were on the official Android Developers site, which is a great reference site, but didn't provide the clearest guidance to get you up and running quickly.  If you're here to get started with Android Development for the first time, save yourself some headaches and head straight over to Lars' tutorial.  Thanks Lars!

Second, the folks at Google have simplified the initial setup and installation process.  No more mucking around to download and install the SDK, then install Eclipse and install the APK plug-in, then tell the APK where your SDK is... all these dependencies can be installed for you from inside Eclipse now, and that awkward SDK configuration is handled for you.  So thanks Google!

So, here are the steps I took to set up my Android development environment.  FYI, I'm working in a VirtualBox VM with a sparkly fresh copy of Ubuntu 11.10.
  • First, open the Ubuntu Software Center, search for "eclipse", and install the Eclipse Integrated Development Environment.  (No need to install eclipse-jdt separately anymore, Ubuntu apparently gives it to you automatically now.  Yay!)  Note that it might take a while to download and install.
  • When it's done installing, launch Eclipse.
  • Use Eclipse's Update Manager (Help -> Install New Software...) to install the Android Development Toolkit plug-in.
    • First, be sure to add the software site for the version of Eclipse that you're using (in my case, it was http://download.eclipse.org/releases/indigo/).  Otherwise Eclipse won't be able to resolve dependencies when installing the ADT plug-in.  I don't know why this isn't added by default, but it always trips me up.
    • Next add Google's ADT software site (https://dl-ssl.google.com/android/eclipse/).
    • Working with the Google software site, select the "Developer Tools" item and it's four sub-items.
    • Click Next, and after Eclipse did some calculating, click Next again to confirm that you want to install the items you selected.
    • Then accept a couple of license agreements, and click Finish.
    • Eclipse will popp up a progress dialog, and do its download and install magic.
      • Note that in the middle of this step, I got a warning prompt asking me to confirm that I want to install unsigned content.  Clicking "Details" revealed that it's Google's ADT components making Eclipse a little nervous.  I clicked OK and didn't look back.
    • When the installation completes, Eclipse should prompt me to restart (Eclipse, not the whole computer), which you should do.
  • After Eclipse restarts, it should prompt you to configure a copy of the Android SDK that it can use.
    • I opted to let it install a new copy of the Android SDK, and chose to install the "latest available version" (4.0.3 at the time I'm doing this).  I left the default install location.
    • Clicking Next will lead to being prompted to let Google gather anonymous usage statistics on the SDK (your choice).
    • After a little bit of Eclipse progress-bar action, you should be prompted to Accept all of the SDK packages you wanted installed.
    • Then the Android SDK Manager will take over, showing a progress bar while it downloads and installs the SDK.
    • Note that only some of the SDK components are installed during this step.  It's enough so you can write and release an app, but there are other components for each API version that you'll also want.
  • In order to install ALL the components for a particular API version, you'll want to select them yourself in the Android SDK Manager.
    • In Eclipse, Window -> Android SDK Manager
    • Under the Packages section, check the box next to any entry or sub-entry that you want to install.  I recommend just checking the box for each version of Android that you want to target, and let it auto-check all of it's sub-entries.
    • Then click Install, and wait...
    • ...and wait...
    • ...and maybe put on a TV show until it finishes downloading and installing.
From here, I should be good to create a new android project.  But that's for another day...


Sunday, November 21, 2010

Fixing Android ADT After Upgrade to Ubuntu 10.10

After upgrading from Ubuntu 10.4 to Ubuntu 10.10, I found that the Android ADT plug-in was not showing up in Eclipse anymore. None of the features were accessible from the Eclipse menus. The "Help -> Install New Software..." dialog would hide the packages when "Hide items that are already installed" was checked, and attempting to re-install gave an "already installed" error message.

Some googling uncovered others with this problem, particularly this helpful post from Sonal. The fix is, basically, to delete the entire configuration directory for eclipse. While a bit heavy-handed for those with complex installations and many installed components, it was fine for me as all I'm doing is Android development. My steps were slightly different from Sonal's, so here's a recap:
  1. Exit eclipse if running
  2. Delete (or backup) ~/.eclipse/org.eclipse.platform_3.5.0_155965261
  3. Start eclipse
  4. Open Help->Install New Software
  5. Add the Eclipse 3.5 Default update site: http://download.eclipse.org/releases/galileo/
    (Note that I explicitly installed the WST Server Adapters, though adding the update site may be enough.)
  6. Add the GEF (Graphical Editor Framework) plugin update site: http://download.eclipse.org/tools/gef/updates/releases
    (I did not explicitly install GEF.)
  7. Add the Google Android ADT plugin update site: https://dl-ssl.google.com/android/eclipse
  8. Install the "Android DDMS" and "Android Development Tools" packages from the Android ADT update site.
Notably, the GEF plugin appears to be new. I don't recall installing this under Ubuntu 10.4. Also, I believe that if you just add the update sites for the dependancies (WST Server Adapters and GEF), they will be installed automatically when you install the Android ADT packages. No need to hunt them down and install them directly. I haven't verified this though.

There may be more re-configuration to be done. I'll update this post with anything I find as it comes up.

Thursday, November 11, 2010

Android Development - Starters Guide

I'm giving Android development another shot, and had to install Eclipse and the Android Development Tools again. Note that this is all on a box running Ubuntu 10.4.

The Android Developers site is a plethora of information, including setup instructions, a developer guide and reference, videos, tutorials, etc. The following pages seem to be the most relevant when first getting started:
  • SDK Download and Quick Start, which includes a to-the-point SDK Quick Start guide
  • Installing the SDK is a more thorough version of the Quick Start guide, including next steps such as recommended reading and tutorials
  • A Hello, World tutorial, the recommended first step for new developers
  • A Notepad tutorial, the recommended second step for new developers
  • Developer Resources lists a few other tutorials that may be worth looking at
Here are the steps I took to prepare my development environment per the 'Installing the SDK' instructions:
  1. I followed (and updated) my old post on Setting up Eclipse and Android Development Tools in Ubuntu to install the required Eclipse packages, and install the Android Development Tools plug-in for Eclipse. This covers steps 1 & 3 of the Quick Start / Installing the SDK guides.
  2. For step 2 of the guides, installing the Android SDK, I downloaded the Linux platform SDK file from the SDK download page and unpacked it from the terminal with 'tar xzvf [filename]'. I also added the SDK tools directory to my path, per instructions in the Installing the SDK guide.
  3. For step 4 of the guides, I ran the GUI 'Android SDK and AVD Manager' by typing 'android' at the terminal (the 'android' executable is in the SDK 'tools' folder). In the 'Available Packages' section, I installed everything. At this time, it included the SDK Platform and Google API packages for Android versions 1.5 - 2.2, the Samples for SDK API 7 and 8 (Android 2.1 and 2.2), and the latest Documentation package.
Note, I've let Eclipse use it's default '~/workspace/' path as my workspace, and I've unpacked the Android SDK into a folder under '~/dev/'. Also, the "Android SDK and AVD Manager" can also be launched from within Eclipse by selecting "Window -> Android SDK and AVD Manager". You must first tell it where to find the SDK by going to "Window -> Preferences -> Android".

From here I was able to successfully complete the "Hello, World" tutorial. Good luck, and happy coding!

Saturday, January 16, 2010

Setting up Eclipse with Android Development Tools in Ubuntu

To get set up for Android App development, I'm following the instructions from Google here:
http://developer.android.com/sdk/installing.html

I installed Eclipse through the Ubuntu Software Center (searched for "eclipse" and clicked install).

Also had to install eclipse-jdt (Java Development Tools) through the Synaptic Package Manager.
Also had to install eclipse-pdt (Plugin Development Tools) through Package Manager.
(Edit 11/11/2010: When going through this process again with Ubuntu 10.4, I used the Ubuntu Software Center instead of the Synaptic Package Manager. Also, I must have meant eclipse-pde - Plugin Development Environment, as I can't find eclipse-pdt listed as an available package.)

Through Eclipses "Help -> Install New Software" dialog, I had to add the basic software source for eclipse (don't know why this isn't set up by default) which is:
http://download.eclipse.org/releases/galileo/
and install "WST Server Adapters" which is apparently a prerequisite for the ADT plugin. Learned that from this site: http://groups.google.com/group/android-developers/browse_thread/thread/1da899d34557f2e8?pli=1

Now to try installing the android plugin (ADT) by adding:
https://dl-ssl.google.com/android/eclipse/
to the eclipse list of software sources.

Looks like that did it! ADT is installed... (now what's next?)