1page.title=Upgrading the SDK 2sdk.version=1.0_r1 3@jd:body 4 5<p>For the current SDK release, see the links under <strong>Current SDK Release</strong> in the side navigation.</p> 6 7<p>This guide will help you migrate your development environment and applications 8to <strong>version 1.0, release 1</strong>, of the Android SDK. Use this guide if you've been developing applications 9on a different version of the Android SDK.</p> 10 11<p>To ensure that your applications are compliant with the Android 1.0 system available 12on mobile devices, you need to install the new SDK and port your existing Android 13applications to the updated API. The sections below guide you through the process.</p> 14 15<h2 id="install-new">Install the new SDK</h2> 16 17<p>After unpacking the SDK, you should:</p> 18 19<ul> 20 <li>Wipe your emulator data. <p>Some data formats have changed since the last 21 SDK release, so any previously saved data in your emulator must be removed. Open a console/terminal 22 and navigate to the <code>/tools</code> directory of your SDK. Launch the 23 emulator with the <code>-wipe-data</code> option. </p> 24 <p>Windows: <code>emulator -wipe-data</code><br/> 25 Mac/Linux: <code>./emulator -wipe-data</code></p> 26 </li> 27 <li>Update your PATH variable (Mac/Linux; optional). <p>If you had previously setup your 28 PATH variable to point to the SDK tools directory, then you'll need to update it to 29 point to the new SDK. E.g., for a <code>.bashrc</code> or <code>.bash_profile</code> file: 30 <code>export PATH=$PATH:<em><your_new_sdk_dir></em>/tools</code></p> 31 </li> 32</ul> 33 34<h2 id="update-plugin">Update your ADT Eclipse Plugin</h2> 35 36<p>If you develop on Eclipse and are using the ADT plugin, follow these steps to install the 37plugin that's required for this version of the SDK.</p> 38 39<table style="font-size:100%"> 40<tr><th>Eclipse 3.3 (Europa)</th><th>Eclipse 3.4 (Ganymede)</th></tr> 41<tr> 42<td width="45%"> 43<ol> 44 <li><a href="http://dl-ssl.google.com/android/ADT-0.8.0.zip">Download the ADT v0.8.0 zip 45 file</a> (do not unpack it).</li> 46 <li>Start Eclipse, then select <strong>Help</strong> > <strong>Software Updates</strong> > <strong>Find 47 and Install...</strong>. </li> 48 <li>In the dialog that appears, select <strong>Search for new features to install</strong> and click 49 <strong>Next</strong>. </li> 50 <li>Click <strong>New Archive Site...</strong></li> 51 <li>Browse and select the downloaded the zip file.</li> 52 <li>You should now see the new site added to the search list (and checked). 53 Click <strong>Finish</strong>. </li> 54 <li>In the subsequent Search Results dialog box, select the checkbox for 55 <strong>Android Plugin</strong> > <strong>Developer Tools</strong>. 56 This will check both features: "Android Developer Tools", and "Android 57 Editors". The Android Editors feature is optional, but recommended. If 58 you choose to install it, you need the WST plugin mentioned earlier in this 59 page. Click <strong>Next</strong>. </li> 60 <li>Read the license agreement and then select <strong>Accept terms of the license agreement</strong>. 61 Click <strong>Next</strong>. </li> 62 <li>Click <strong>Finish</strong>. </li> 63 <li>The ADT plugin is not signed; you can accept the installation anyway 64 by clicking <strong>Install All</strong>. </li> 65 <li>Restart Eclipse. </li> 66</ol> 67 68</td> 69<td> 70 71<ol> 72 <li><a href="http://dl-ssl.google.com/android/ADT-0.8.0.zip">Download the ADT v0.8.0 zip 73 file</a> (do not unpack it).</li> 74 <li>Start Eclipse, then select <strong>Help</strong> > <strong>Software Updates...</strong>.</li> 75 <li>In the dialog that appears, click the <strong>Available Software</strong> tab.</li> 76 <li>Click <strong>Add Site...</strong>, then <strong>Archive...</strong>.</li> 77 <li>Browse and select the downloaded the zip file.</li> 78 <li>Back in the Available Software view, you should see the plugin. Select the checkbox next to 79 <em>Developer Tools</em> and click <strong>Install...</strong></li> 80 <li>On the subsequent Install window, "Android Developer Tools", and "Android Editors" should both be checked. 81 The Android Editors feature is optional, but recommended. If 82 you choose to install it, you need the WST plugin mentioned earlier in this 83 page. Click <strong>Next</strong>.</li> 84 <li>Accept the license agreement and click <strong>Finish</strong>.</li> 85 <li>Restart Eclipse. </li> 86</ol> 87 88</td> 89</tr> 90</table> 91 92<p>After restart, update your Eclipse preferences to point to the SDK directory:</p> 93 <ol> 94 <li>Select <strong>Window</strong> > <strong>Preferences...</strong> to open the Preferences panel. (Mac OSX: <strong>Eclipse</strong> > <strong>Preferences</strong>)</li> 95 <li>Select <strong>Android</strong> from the left panel.</li> 96 <li>For the SDK Location in the main panel, click <strong>Browse...</strong> and locate the SDK directory.</li> 97 <li>Click <strong>Apply</strong>, then <strong>OK</strong>.</li> 98 </ol> 99 100<h2 id="sign">Set Up Application Signing</h2> 101 102<p>All applications must now be signed before you can install them on the emulator. Both 103the ADT plugin and the Ant-based build tools support this requirement by signing compiled 104.apk files with a debug key. To do so, the build tools use the Keytool utility included 105in the JDK to to create a keystore and a key with a known alias and password. For more 106information, see "Signing and Publishing Your App" in the documentation included with the SDK. 107 108<p>To support signing, you should first make sure that Keytool is available to the SDK build 109tools. In most cases, you can tell the SDK build tools how to find Keytool by making sure that 110your JAVA_HOME environment variable is set and that it references a suitable JDK. Alternatively, 111you can add the JDK version of Keytool to your PATH variable.</p> 112 113<p>If you are developing on a version of Linux that originally came with Gnu Compiler for Java, 114make sure that the system is using the JDK version of Keytool, rather than the gcj version. 115If keytool is already in your PATH, it might be pointing to a symlink at /usr/bin/keytool. 116In this case, check the symlink target to make sure that it points to the keytool in the JDK.</p> 117 118<p>If you use Ant to build your .apk files (rather than ADT for Eclipse), you must regenerate 119your build.xml file. To do that, follow these steps:</p> 120<ol> 121 <li>In your Android application project directory, locate and delete the current build.xml file.</li> 122 <li>Run activitycreator, directing output to the folder containing your application project. 123 124<pre>- exec activitycreator --out <project folder> your.activity.YourActivity</pre> 125 126 </li> 127</ol> 128 129<p>Run in this way, activitycreator will not erase or create new Java files (or manifest files), 130provided the activity and package already exists. It is important that the package and the activity 131are real. The tool creates a new build.xml file, as well as a new directory called "libs" in which 132to place 3rd jar files, which are now automatically handled by the Ant script.</p> 133 134<h2 id="migrate">Migrate your applications</h2> 135 136<p>If (and only if) you have written apps in an SDK released previous to 137the Android 1.0 SDK, you will need to migrate your applications. After 138updating your SDK, you may encounter breakages in your code, due to 139framework and API changes. You'll need to update your code to match 140changes in the Android APIs.</p> 141 142<p>One way to start is to open your project in Eclipse and see where the ADT 143identifies errors in your application. You can also look up 144specific changes in the Android APIs in the <em>Overview of Changes</em> and <em> 145API Diffs Report</em>, both available in the documentation included with the 146Android 1.0 SDK package.</p> 147 148<p>If you have additional trouble updating your code, visit the 149<a href="http://groups.google.com/group/android-developers">Android Developers Group</a> 150to seek help from other Android developers.</p> 151 152<p>If you have modified one of the ApiDemos applications and would like to migrate it 153to the new SDK, note that you will need to uninstall the version of ApiDemos that comes 154preinstalled in the emulator.</p> 155