summaryrefslogtreecommitdiffstats
path: root/docs/html/sdk/1.0_r1/upgrading.jd
blob: 168f1be288a50e37eb781f8c272da958fd984aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
page.title=Upgrading the SDK
@jd:body

<div class="sidebox-wrapper">
  <div class="sidebox-inner">

     <h2>Useful Links</h2>

      <ul class="noindent">
        <li><a href="migrating/0.9-1.0/changes-overview.html">Overview of Changes</a>
		      <p>A high-level look at what's changed in Android, with 
		       discussion of how the changes may affect your apps.</p></li>

        <li><a href="migrating/0.9-1.0/changes.html">API Diff Report</a> 
                <p>A detailed report that lists all the specific changes in the latest SDK.</p></li>

        <li><a href="RELEASENOTES.html">Release Notes</a> 
                <p>Version details, known issues, and resolved issues. </p></li>

        <li><a href="http://groups.google.com/group/android-developers">Android Developers Group</a> 
            <p>A forum where you can discuss migration issues and learn from other Android developers. </p></li>
 
        <li><a href="http://code.google.com/p/android/issues/list">Android Issue Tracker</a>
            <p>If you think you may have found a bug, use the issue tracker to report it.</p></li>
      </ul>

   </div>
</div><!-- class-sidebox -->


<p>This guide will help you migrate your development environment and applications
to the latest version of the SDK. Use this guide if you've been developing applications
on a previous version of the Android SDK. 
</p>

<p>To ensure that your applications are compliant with the Android 1.0 system available 
on mobile devices, you need to install the new SDK and port your existing Android 
applications to the updated API. The sections below guide you through the process.</p>

<h2 id="install-new">Install the new SDK</h2>

<p><a href="{@docRoot}download.html">Download the SDK</a> and unpack it into a safe location.</p>

<p>After unpacking the new SDK, you should:</p>

<ul>
  <li>Wipe your emulator data. <p>Some data formats have changed since the last
  SDK release, so any previously saved data in your emulator must be removed. Open a console/terminal
  and navigate to the <code>/tools</code> directory of your SDK. Launch the 
  emulator with the <code>-wipe-data</code> option. </p>
  <p>Windows: <code>emulator -wipe-data</code><br/>
   Mac/Linux: <code>./emulator -wipe-data</code></p>
  </li>
  <li>Update your PATH variable (Mac/Linux; optional). <p>If you had previously setup your 
  PATH variable to point to the SDK tools directory, then you'll need to update it to 
  point to the new SDK. E.g., for a <code>.bashrc</code> or <code>.bash_profile</code> file:
  <code>export PATH=$PATH:<em>&lt;your_new_sdk_dir></em>/tools</code></p>
  </li>
</ul>

<h2 id="update-plugin">Update your ADT Eclipse Plugin</h2>

<p>If you develop on Eclipse and are using the ADT plugin, follow these steps to install the new plugin that accompanies the latest SDK.</p>

<table style="font-size:100%">
<tr><th>Eclipse 3.3 (Europa)</th><th>Eclipse 3.4 (Ganymede)</th></tr>
<tr>
<td width="50%">
<ol>
    <li> Select <strong>Help</strong> &gt; <strong>Software Updates</strong> &gt; <strong>Find and Install...</strong>. </li>
    <li> Select <strong>Search for updates of the currently installed features</strong> and click <strong>Finish</strong>. </li>
    <li> If any update for ADT is available, select and install. </li>
    <li> Restart Eclipse.</li>
</ol>
</td>
<td>
<ol>
    <li>Select <strong>Help</strong> &gt; <strong>Software Updates...</strong></li>
    <li>Select the <strong>Installed Software</strong> tab.</li>
    <li>Click <strong>Update...</strong></li>
    <li>If an update for ADT is available, select it and click <strong>Finish</strong>.</li>
    <li>Restart Eclipse.</li>
</ol>
</td>
</tr>
</table>

<p>After restart, update your Eclipse preferences to point to the SDK directory:</p>
    <ol>
      <li>Select <strong>Window</strong> > <strong>Preferences...</strong> to open the Preferences panel. (Mac OSX: <strong>Eclipse</strong> > <strong>Preferences</strong>)</li>
      <li>Select <strong>Android</strong> from the left panel.</li>
      <li>For the SDK Location in the main panel, click <strong>Browse...</strong> and locate the SDK directory.</li>
      <li>Click <strong>Apply</strong>, then <strong>OK</strong>.</li>
    </ol>

<h2 id="sign">Set Up Application Signing</h2>

<p>All applications must now be signed before you can install them on the emulator. Both 
the ADT plugin and the Ant-based build tools support this requirement by signing compiled 
.apk files with a debug key. To do so, the build tools use the Keytool utility included 
in the JDK to to create a keystore and a key with a known alias and password. For more 
information, see <a href="{@docRoot}guide/publishing/app-signing.html">Signing Your Applications</a>.

<p>To support signing, you should first make sure that Keytool is available to the SDK build 
tools. In most cases, you can tell the SDK build tools how to find Keytool by making sure that 
your JAVA_HOME environment variable is set and that it references a suitable JDK. Alternatively, 
you can add the JDK version of Keytool to your PATH variable.</p>

<p>If you are developing on a version of Linux that originally came with Gnu Compiler for Java, 
make sure that the system is using the JDK version of Keytool, rather than the gcj version. 
If keytool is already in your PATH, it might be pointing to a symlink at /usr/bin/keytool. 
In this case, check the symlink target to make sure that it points to the keytool in the JDK.</p>

<p>If you use Ant to build your .apk files (rather than ADT for Eclipse), you must regenerate 
your build.xml file. To do that, follow these steps:</p>
<ol>
  <li>In your Android application project directory, locate and delete the current build.xml file.</li>
  <li>Run activitycreator, directing output to the folder containing your application project.

<pre>- exec activitycreator --out &lt;project folder&gt; your.activity.YourActivity</pre>

  </li>
</ol>

<p>Run in this way, activitycreator will not erase or create new Java files (or manifest files), 
provided the activity and package already exists. It is important that the package and the activity 
are real. The tool creates a new build.xml file, as well as a new directory called "libs" in which 
to place 3rd jar files, which are now automatically handled by the Ant script.</p>

<h2 id="migrate">Migrate your applications</h2>

<p>After updating your SDK, you will likely encounter breakages in your code, due to 
framework and API changes. You'll need to update your code to match changes in the Android APIs.</p>

<p>One way to start is to open your project in Eclipse and see where the ADT
identifies errors in your application. From there, you can lookup
respective changes in the 
<a href="migrating/changes-overview.html">Overview of Changes</a>
and <a href="migrating/changes.html">API Diffs Report</a>.</p>

<p>If you have additional trouble updating your code, visit the 
<a href="http://groups.google.com/group/android-developers">Android Developers Group</a>
to seek help from other Android developers.</p>

<p>If you have modified one of the ApiDemos applications and would like to migrate it 
to the new SDK, note that you will need to uninstall the version of ApiDemos that comes 
preinstalled in the emulator. For more information, or if you encounter an "reinstallation" 
error when running or installing ApiDemos, see the troubleshooting topic 
<a href="{@docRoot}guide/appendix/faq/troubleshooting.html#apidemosreinstall">I can't install ApiDemos 
apps in my IDE because of a signing error</a> for information about how to solve the problem.</p>