page.title=Upgrading the SDK sdk.version=1.6 sdk.preview=true @jd:body

Upgrading the SDK

In this document

  1. Install the SDK
  2. Update Your Eclipse ADT Plugin
  3. Run Your Applications
  4. Convert Your Applications

Migrating references

  1. Android 1.6 Early Look API Differences

This document describes how to move your development environment and existing Android applications from an Android 1.5 SDK to the Android 1.6 Early Look SDK. If you are migrating applications from an SDK older than 1.5, please also read the upgrading document available in the Android 1.5 SDK package.

There are several compelling reasons to upgrade, such as new SDK tools that make developing more efficient and new APIs that allow you to expand the feature-set of your applications. However, even if you or your applications don't require these enhancements, it's important that you upgrade to ensure that your applications run properly on the upcoming Android platform.

The Android 1.6 platform will soon be deployable to devices around the world. If you have already released Android applications to the public, you should test the forward-compatibility of your applications on the latest version of the platform as soon as possible. It's unlikely that you'll encounter breakage in your applications, but in the interest of maintaining the best user experience, you should take no risks. So, please install the new Android SDK and test your applications on the new platform.

Install the SDK

Now that you have the Android 1.6 Early Look SDK, you need to perform some of the regular installation steps.

If you had previously setup your PATH variable to point to the SDK tools directory, then you need to update it to point to the new SDK. For example, for a .bashrc or .bash_profile file:

export PATH=$PATH:<your_sdk_dir>/tools

Update Your Eclipse ADT Plugin

If you don't use Eclipse for development, skip to Run Your Applications.

A new ADT plugin (version 0.9.2) is required for the Android 1.6 Early Look SDK. With ADT 0.9.2, you can still compile your applications against multiple platform versions, such as Android 1.5. However, previous versions of ADT will not work with the Android 1.6 Early Look SDK, so you must upgrade to ADT 0.9.2.

If you're currently using a version of ADT older than version 0.9, then you must uninstall ADT before you proceed (read how to Uninstall your previous ADT plugin). If you currently have version 0.9 or 0.9.1, then you don't need to uninstall and can continue with the procedure below.

Install the 0.9.2 ADT plugin

To install the new ADT plugin, follow the steps below for your respective version of Eclipse.

Eclipse 3.3 (Europa)Eclipse 3.4 (Ganymede)
  1. Select Help > Software Updates > Find and Install.
  2. Select Search for new features to install.
  3. Select the Android plugin entry by checking the box next to it, then click Finish.

    (Your original entry for the plugin should still be here. If not, see the guide to Installing the ADT Plugin.)

  4. In the results, expand the entry for the Android plugin and be sure that "Developer Tools" is checked, then click Next. (This will install "Android DDMS" and "Android Development Tools".)
  5. Read and accept the license agreement, then click Next.
  6. In the next window, click Finish to start installation.
  7. The ADT plugin is not digitally signed. Accept the installation anyway by clicking Install All.
  8. Restart Eclipse.
  1. Select Help > Software Updates.
  2. Select the Available Software tab.
  3. Expand the entry for the Andriod plugin (may be listed as the location URL) and select "Developer Tools" by checking the box next to it, then click Install.
  4. On the next window, "Android DDMS" and "Android Development Tools" should both be checked. Click Finish.
  5. Restart Eclipse.

If you encounter problems with this update procedure, try performing a fresh installation. Ensure your current ADT is fully uninstalled and then follow the guide to Installing the ADT Plugin for Eclipse.

Update your Eclipse SDK Preferences

The last step is to update your Eclipse preferences to point to the new SDK directory:

  1. Select Window > Preferences to open the Preferences panel (Mac: Eclipse > Preferences).
  2. Select Android from the left panel.
  3. For the SDK Location, click Browse and locate your SDK directory.
  4. Click Apply, then OK.

Run Your Applications

Now that you have installed the Android 1.6 Early Look SDK, we encourage you to run each of your applications in an instance of the emulator that's running the new Android 1.6 system image. It's possible (however, unlikely) that you'll encounter unexpected behavior in your application when you run your applications on the new system image. Whether you believe your application will be affected by platform changes or not, it's very important that you test the application's forward-compatibility.

To test forward-compatibility, simply run your application, as-is, on an instance of the Android Emulator that uses an AVD targeted to "Android Donut (Preview)":

  1. Make no changes to your application code.
  2. Create a new AVD that's targeted to the "Donut" platform.
  3. Launch your application in an emulator running the new AVD.
  4. Perform normal testing on your application to ensure everything works as expected.

For more information on creating an AVD and launching your application refer to the Eclipse guide to Running Your Application or the Ant guide to Running Your Application, depending on your development environment.

Convert Your Applications

If you want to fully utilize new APIs introduced with the Android 1.6 Early Look SDK, then you'll need to convert your application to compile against the new "Donut" platform.

First, you need to change the value of the minSdkVersion attribute in the <uses-sdk> manifest element. While running your application against the Donut platform included with the Early Look SDK, you must set the minSdkVersion value to "Donut". For example:

<manifest>
  ...
  <uses-sdk android:minSdkVersion="Donut" />
  ...
</manifest>

This value is required only while compiling against the Donut platform included with the Android 1.6 Early Look SDK. Once the final SDK is made available for Android 1.6, you will need to change this value. For more information, read about the Framework API and Provisional API Level.

Once you've changed the minSdkVersion value in your application's manifest, continue with the procedures below to convert your applications.

Eclipse users

  1. Right-click on the individual project (in the Package Explorer) and select Properties.
  2. In the properties, open the Android panel and select a new Project Build Target. Select "Android Donut (Preview)" to target the new platform (or "Google APIs" with the "Donut" platform if your application uses the Maps APIs).
  3. Click Apply, then OK.

Remember that you must create an AVD that targets the same platform in order to run the emulator. Continue with the Eclipse guide to Running Your Application. During the procedure to Running Your Application, select a "deployment target" or the AVD that includes the "Donut" platform. If your application utilizes the Google Maps APIs (i.e., MapView), be certain to select a target that includes the Google APIs.

Ant users

Use the android tool (located in your_sdk/tools/) to create a new build.xml that references the new platform target. To see a list of available targets, execute:

android list targets

Select the target id that corresponds to the "Donut" platform and pass it with the --target parameter when updating your project. For example:

android update project --path /path/to/my-project --target 2

Remember that you must create an Android Virtual Device (AVD) that's targeted to the same platform before you can run the updated application an instance of the emulator. Please continue with the Ant guide to Running Your Application. During the procedure to Running Your Application, select a "deployment target" for the AVD that includes the "Donut" platform. If your application utilizes the Google Maps APIs (i.e., MapView), be certain to select a target that includes the Google APIs.

If you have additional trouble updating your code, visit the Android Developers Group to seek help from other Android developers.