Update the Android SDK and your current target API packages using the Android SDK Manager on a regular basis.
This article describes the task of updating your installed Android SDK Manager components and target development environment in Windows 7.
Important: If you are in a development team it is quite important to perform this task on all development machines at the same time.
The Google Android team releases security and bug fixes to every released version of the Android SDK (i.e 2.3, 4.0, etc). In addition, Google always selects for you a check box for installing the latest version; however, this is only a suggestion and it can be unchecked. For brevity’s sake we will choose not to install any new target version in this explanation
Before bringing your Android SDK components up to date, make sure to update your Java JRE first as described here.
This post assumes that you have compiled successfully at least one project in your machine. If not, we will do it as part of the instructions.
- Open Eclipse and open a workspace with an existing Android project that compiles correctly.
- From the Eclipse menu, select ‘Project’ followed by ‘Clean’. From the Clean project dialog box, unclick the ‘start a build immediately’ option.
- Select Project -> Build All
You should see file r.java under the gen\<project package> (Generated Java Files) folder:
Although compilation of a project may seem unnecessary, it is a sanity check to confirm that the system worked fine before the component upgrade.
- Exit Eclipse and open the ‘SDK Manager’ application
If you have not opened the SDK Manager for some time, chances are that at least one of the components in the tools folder has had an update, for example:
Android Tools SDK Tools
Android SDK Platform Tools
- If any of the components under Tools needs an update, uncheck any components in other folders and perform this upgrade first.
The following screenshot shows typical updates that need to be unchecked. Don’t worry, you will get a chance to install or upgrade them afterwards.
- Click on the ‘Install packages’ button (In this example there should be only one package left to install). Clicking on the Install button also triggers the deleted made by the ‘Delete’ button
In our particular example, the Android SDK Tools gets upgraded (rev 21.1 removed and rev. 22 installed). Doing this ensures that the SDK Manager application is stable before attempting to install further updates.
- After the SDK Tools upgrade, you may get the following message:
The Android SDK and AVD Manager that you are currently using has been updated …
- Click OK to ignore it and exit SDK Manager
Next, it’s time to upgrade our working target version(s) SDK plus any other new components. This may even include new updates to the Tools folder
- Open SDK Manager again and the process for reading from Android and third party repositories begins again
Notice how after upgrading the Tools components, the Tools component folder gets a full renewal of all subcomponents. There is even a new component in this example: ‘Android SDK Build-Tools’
- Uncheck the latest Android SDK platform if you do not plan to develop with it.
- Carefully review upgrades of previously installed components, make a note of any sudden changes.
Having someone appointed at a team level to document these changes can become a good reference point. In the example above, the API 10 SDK platform is at revision 2. The only component that needs changes is the Intel Atom ROM.
- Click on install to upgrade everything
- Close SDK Manager. The warning to upgrade eclipse components may appear again:
- Click OK and exit SDK Manager
- Open Eclipse using the same workspace/project used at the start of this task.
Right after entering your project you may perceive something is not OK. This is a screenshot of what you might see: errors and incompatibilities.
This is a sign that the ADT plugin used in Eclipse is out of date. This is a common occurrence after upgrading SDK Manager. In simple terms, the ADT plugin should have a very similar or identical version number as the one for SDK Tools
- From Eclipse, select ‘Help’->’Check for Updates’. After a brief time, the list of installed plugins that require an upgrade is displayed
- Select the ‘Next’ button, accept the license agreements and the ADT plugin will start to be upgraded.
- You will get a warning like the following: “you are installing software that contains unsigned content…” this is an Eclipse security message that indicates that ADT does not have a digital signature. Click on the ‘Details’ button and visually confirm that the unsigned components are coming from Google.
- You may click ‘OK’ to continue ADT upgrade.
- After this, you will need to restart Android for the updates to take effect.
- You may now reload, recompile, and even redeploy your existing application.
This process may not be the quickest to get right at first, but the rewards in terms of awareness of the Android team’s aims is priceless.