Upgrading the SDK

Upgrading quickview

  • The Android 1.5 SDK uses a new project structure and a new ADT plugin (ADT 0.9).
  • To move existing projects into the SDK, you must make some minor changes in your development environment.
  • The new ADT plugin (ADT 0.9) is not compatible with projects created in previous SDKs.
  • You need to uninstall your existing ADT plugin, before installing ADT 0.9.

In this document

  1. Install the SDK
  2. Update Your Eclipse ADT Plugin
  3. Update Your Projects
    1. Eclipse Users
    2. Ant Users
  4. Migrate Your Applications
    1. Future-proof your apps

Migrating references

  1. Android 1.5 API Differences
  2. Future-Proofing Your Apps »
  3. UI framework changes in Android 1.5 »

This document describes how to move your development environment and existing Android applications from an Android 1.0 or 1.1 SDK to the Android 1.5 SDK. If you are migrating applications from an SDK older than 1.0, please also read the upgrading document available in the Android 1.0 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 Android 1.5 platform.

The Android 1.5 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 Android 1.5.

For more information on new SDK features and system changes, see the Android 1.5 Version Notes.

Install the SDK

If you haven't yet downloaded the SDK, download from here and unpack it into a safe location.

Before you begin: 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

If you don't use Eclipse for development, skip to Update Your Projects.

Update Your Eclipse ADT Plugin

If you installed ADT-0.9_pre with the early look 1.5 SDK, there have been additional changes, so please continue with this guide and update to the final ADT 0.9.

A new ADT plugin (version 0.9) is required for the Android 1.5 SDK. Because the component structure has been changed since Android 1.1, the Android 1.5 SDK does not work with ADT 0.8 (or older) and previously installed SDKs will not work with ADT 0.9. However, the Android 1.5 SDK includes an Android 1.1 SDK image that you can build against while using ADT 0.9.

For information about using different system images (such as Android 1.1) while running this SDK, see Developing In Eclipse, with ADT or In Other IDEs, as appropriate for your development environment.

In order to upgrade your Eclipse IDE to use the new 0.9 ADT, follow the steps below for your respective version of Eclipse.

Uninstall your previous ADT plugin

You must uninstall your existing ADT plugin (0.8 or older). If you do not uninstall it, you will get a conflict with the Android Editors when installing the new ADT. (If you have already installed ADT-0.9_pre with the early look 1.5 SDK, you can skip this uninstall procedure and continue to Install the 0.9 ADT plugin).

Eclipse 3.3 (Europa)Eclipse 3.4 (Ganymede)
  1. Select Help > Software Updates > Manage Configuration.
  2. Expand the list in the left panel to reveal the installed tools.
  3. Right-click "Android Editors" and click Uninstall. Click OK to confirm.
  4. Restart Eclipse.

    (Do not uninstall "Android Development Tools".)

  1. Select Help > Software Updates.
  2. Select the Installed Software tab.
  3. Select "Android Editors". Click Uninstall.
  4. In the next window, be sure "Android Editors" is checked, then click Finish to uninstall.
  5. Restart Eclipse.

    (Do not uninstall "Android Development Tools".)

Install the 0.9 ADT plugin

Only install the new plugin once you've completed the procedure to Uninstall your previous ADT plugin.

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, ensure your 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 in the main panel, click Browse and locate your SDK directory.
  4. Click Apply, then OK.

Update Your Projects

You will now need to update any and all Android projects that you have developed using a previous version of the Android SDK.

Eclipse users

If you use Eclipse to develop applications, use the following procedure to update each project:

  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 "build target" to compile against. This SDK offers the Android 1.1 and Android 1.5 platforms to choose from. When you are initially updating your projects to the new SDK, we recommend that you select a build target with the Android 1.1 platform. Click Apply, then OK.

The new plugin creates a gen/ folder in your project, in which it puts the R.java file and all automatically generated AIDL java files. If you get an error such as The type R is already defined, then you probably need to delete your old R.java or your old auto-generated AIDL Java files in the src/ folder. (This does not apply to your own hand-crafted parcelable AIDL java files.)

Note that, with the Android 1.5 SDK, there is a new process for running applications in the Android Emulator. Specifically, you must create an Android Virtual Device (AVD) before you can launch an instance of the Emulator. Before attempting to run your applications with the new SDK, please continue with the section below to Migrate Your Applications.

Ant users

If you build your projects using the Ant tool (rather than with Eclipse), note the following changes with the new SDK tools.

build.xml has changed

You must re-create your build.xml file.

If you had customized your build.xml, first make a copy of it:

$ cd my-project
$ cp build.xml build.xml.old

Now use the new android tool (located in your_sdk/tools/) to create a new build.xml that references a specific platform target:

$ android update project --path /path/to/my-project --target 1

The "target" corresponds to an Android platform library (including any add-ons, such as Google APIs) that you would like to build your project against. You can view a list of available targets (and their corresponding integer ID) with the command, android list targets. When you are initially updating your projects to the new SDK, we recommend that you select the first target ("1"), which uses the Android 1.1 platform library.

A gen/ folder will be created the first time you build and your R.java and your AIDL Java files will be generated in here. You must remove the old R.java and old auto-generated AIDL java files from the src/ folder. (This does not apply to your own hand-crafted parcelabe AIDL java files.)

Note: The "activitycreator" tool has been replaced by the new "android" tool. For information on creating new projects with the android tool, see the documentation about Developing In Other IDEs.

Note that, with the Android 1.5 SDK, there is a new process for running applications in the Android Emulator. Specifically, you must create an Android Virtual Device (AVD) before you can launch an instance of the Emulator. Before attempting to run your applications with the new SDK, please continue with the section below to Migrate Your Applications.

Migrate Your Applications

After you have completed the process above to Update Your Projects, you are strongly encouraged to run each of your applications in an instance of the emulator running the Android 1.5 system image. It's possible (however, unlikely) that you'll encounter some breakage in your application when you run your applications on the Android 1.5 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 on Android 1.5.

To test forward-compatibility, simply run your existing application (as-is) on an Android Emulator that's running the Android 1.5 system image. The following procedure will guide you through the process to running your existing applications on an emulator. Please read the following guide completely before you begin.

To test your application on an emulator running Android 1.5:

  1. Update Your Project (you should have done this already, in the section above).
  2. Run your existing project, as-is, on an emulator running the Android 1.5 system image.

    As mentioned in the guide to Update Your Projects, you should have selected a "build target" of "1", which compiles your application against the Android 1.1 system image, so there should be no new errors in your code.

    Eclipse users: follow the Eclipse guide to Running Your Application.

    Ant users: follow the Ant guide to Running Your Application

    During the procedure to Running Your Application, select a "deployment target" for the AVD that includes the Android 1.5 platform. If your application utilizes the Google Maps APIs (i.e., MapView), be certain to select a target that includes the Google APIs.

    Once you complete the procedures to run your application in your respective environment, linked above, return here.

  3. With your application running in the emulator, perform all regular testing on the application to ensure that it functions normally (in both landscape and portrait orientations).

Chances are, your application runs just fine on the Android 1.5 platform — new devices will be able to safely install and run your application and current users who update their devices will be able to continue using your application as usual. However, if something doesn't work the way you expect, then you might need to revisit your project and make any necessary changes to your code.

You can check for code breakages caused by API changes by opening your project in Eclipse, changing the "build target" to one using the Android 1.5 platform, and see where the ADT identifies errors in your code.

Future-proof your apps

There have been several API additions made for this release, but there have been very few actual API changes. Only a couple (relatively unused) elements have been removed and a few have been deprecated, so your applications written with the Android 1.1 system library should work just fine. However, your application is more likely to encounter problems on Android 1.5 if it performs any of the following:

  • Uses internal APIs. That is, APIs that are not officially supported and not available in the reference documentation. Any un-official APIs are always subject to change (which is why they're un-official) and some have indeed changed.
  • Directly manipulates system settings. There are some settings (such as GPS, data roaming, bluetooth and others) that used to be writable by applications but have been changed so that they can only be explicitly modified by the user through the system settings. Refer to Settings.Secure to see which settings are now secured and cannot be directly changed by your application.
  • Uses View hierarchies that are unreasonably deep (more than 10 or so levels) or broad (more than 30 total). View hierarchies this big have always been troublesome, but Android 1.5 is much more efficient at exposing this and your application may crash.
  • Makes assumptions about the available hardware. With new support for soft keyboards, not all devices will have full QWERTY keyboards on the hardware. So if your application listens for special keypress events that only occur on a keypad, then your application should degrade gracefully when there is no keyboard available.
  • Performs its own layout orientation changes based on the acceletometer (or via other sensors). Some devices running Android 1.5 will automatically rotate the orientation (and all devices have the option to turn on auto-rotation), so if your application also attempts to rotate the orientation, it can result in strange behavior. In addition, if your application uses the accelerometer to detect shaking and you do not want to rotate the orientation, then you should lock the current orientation with android:screenOrientation.

Please read our blog post on Future-Proofing Your Apps for more information on the issues mentioned above.

For information about other changes made to Android 1.5, refer to the following documents:

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

↑ Go to top