page.title=Upgrading the SDK sdk.version=1.6 sdk.preview=true @jd:body
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.
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
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.
To install the new ADT plugin, follow the steps below for your respective version of Eclipse.
Eclipse 3.3 (Europa) | Eclipse 3.4 (Ganymede) |
---|---|
|
|
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.
The last step is to update your Eclipse preferences to point to the new SDK directory:
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)":
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.
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.
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.
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.