OSDN Git Service

docs: consistency fixit for the quickview boxes in the dev guide
[android-x86/frameworks-base.git] / docs / html / guide / publishing / preparing.jd
1 page.title=Preparing to Publish: A Checklist
2 @jd:body
3
4 <p>Publishing an application means testing it, packaging it appropriately, and 
5 making it available to users of Android-powered mobile devices.</p>
6
7 <p>If you plan to publish your application for installation on
8 Android-powered devices, there are several things you need to do, to get
9 your application ready. This document highlights the significant
10 checkpoints for preparing your application for a successful release.
11 </p>
12
13 <p>If you will publish your application on Android Market, please also see <a
14 href="{@docRoot}guide/publishing/publishing.html#market">Publishing on Android Market</a> 
15 for specific preparation requirements for your application. </p>
16
17 <p>For general information about the ways that you can publish an applications, 
18 see the <a href="{@docRoot}guide/publishing/publishing.html">Publishing Your 
19 Applications</a> document. </p>
20
21 <div class="special">
22
23 <p><a href="#releaseready">Before you consider your application ready for release</a>:</p>
24
25 <ol>
26 <li>Test your application extensively on an actual device </li>
27 <li>Consider adding an End User License Agreement in your application</li>
28 <li>Consider adding licensing support</li>
29 <li>Specify an icon and label in the application's manifest</li>
30 <li>Turn off logging and debugging and clean up data/files</li>
31 </ol>
32
33 <p><a href="#finalcompile">Before you do the final compile of your application</a>:</p>
34
35 <ol start="6">
36 <li>Version your application</li>
37 <li>Obtain a suitable cryptographic key</li>
38 <li>Register for a Maps API Key, if your application is using MapView elements</li>
39 </ol>
40
41 <p><a href="#compile">Compile your application</a></p>
42
43 <p><a href="#post-compile">After you compile your application</a>:</p>
44 <ol start="9">
45 <li>Sign your application</li>
46 <li>Test your compiled application</li>
47 </ol>
48 </div>
49
50 <h2 id="releaseready">Before you consider your application ready for release</h2>
51
52 <h3 id="test">1. Test your application extensively on an actual device</h3>
53
54 <p>It's important to test your application as extensively as possible, in as
55 many areas as possible. To help you do that, Android provides a variety of
56 testing classes and tools. You can use 
57 {@link android.app.Instrumentation Instrumentation} to run JUnit and other 
58 test cases, and you can use testing
59 tools such as the <a href="{@docRoot}guide/developing/tools/monkey.html">UI/Application
60 Exerciser Monkey</a>.  </p>
61
62 <ul>
63 <li>To ensure that your application will run properly for users, you should make
64 every effort to obtain one or more physical mobile device(s) of the type on
65 which you expect the application to run. You should then test your application
66 on the actual device, under realistic network conditions. Testing  your
67 application on a physical device is very important, because it enables you to
68 verify that your user interface elements are sized correctly (especially for
69 touch-screen UI) and that your application's performance and battery efficiency
70 are acceptable.</li>
71
72 <li>If you can not obtain a mobile device of the type you are targeting for your
73 application, you can use emulator options such as <code>-dpi</code>,
74 <code>-device</code>, <code>-scale</code>, <code>-netspeed</code>,
75 <code>-netdelay</code>, <code>-cpu-delay</code> and others to model the
76 emulator's screen, network performance, and other attributes to match the target
77 device to the greatest extent possible. You can then test your application's UI
78 and performance. However, we strongly recommend that you test your application
79 on an actual target device before publishing it. </li>
80
81 <li>If you are targeting the <a href="http://www.t-mobileg1.com/">T-Mobile
82 G1</a> device for your application, make sure that your UI handles screen
83 orientation changes. </li>
84 </ul>
85
86 <h3 id="eula">2. Consider adding an End User License Agreement in your 
87 application</h3>
88
89 <p>To protect your person, organization, and intellectual property, you may want
90 to provide an End User License Agreement (EULA) with your application. 
91
92 <h3 id="eula">3. Consider adding support for Android Market Licensing</h3>
93
94 <p>If you are publishing a paid application through Android Market, consider
95 adding support for Android Market Licensing. Licensing lets you control access
96 to your application based on whether the current user has purchased it.
97 Using Android Market Licensing is optional. 
98
99 <p>For complete information about Android Market Licensing Service and how to
100 use it in your application, see <a
101 href="{@docRoot}guide/publishing/licensing.html">Licensing Your
102 Applications</a>.</p>
103
104 <h3 id="iconlabel">4. Specify an icon and label in the application's manifest</h3>
105
106 <p>The icon and label that you specify in an application's manifest are
107 important because they are displayed to users as your application's icon and
108 name. They are displayed on the device's Home screen, as well as in Manage
109 Applications, My Downloads, and elsewhere. Additionally, publishing services may
110 display the icon and label to users. </p>
111
112 <p>To specify an icon and label, you define the attributes
113 <code>android:icon</code> and <code>android:label</code> in the 
114 <code>&lt;application&gt;</code> element of the manifest. </p>
115
116 <p>As regards the design of your icon, you should try to make it match as much
117 as possible the style used by the built-in Android applications.</p>
118
119 <h3 id="logging">5. Turn off logging and debugging and clean up data/files</h3>
120
121 <p>For release, you should make sure that debug facilities are turned off and
122 that debug and other unnecessary data/files are removed from your application
123 project.</p>
124 <ul>
125 <li>Remove the <code>android:debuggable="true"</code> attribute from the
126 <code>&lt;application&gt;</code> element of the manifest.</li>
127 <li>Remove log files, backup files, and other unnecessary files from the
128 application project.</li>
129 <li>Check for private or proprietary data and remove it as necessary.</li>
130 <li>Deactivate any calls to {@link android.util.Log} methods in the source
131 code.</li>
132 </ul>
133
134 <h2 id="finalcompile">Before you do the final compile of your application</h2>
135
136 <h3 id="versionapp">6. Version your application</h3>
137
138 <p>Before you compile your application, you must make sure that you have defined
139 a version number for your application, specifying an appropriate value for both
140 the <code>android:versionCode</code> and <code>android:versionName</code>
141 attributes of the <code>&lt;manifest&gt;</code> element in the application's
142 manifest file. Carefully consider your version numbering plans in the context of
143 your overall application upgrade strategy. </p>
144
145 <p>If you have previously released a version of your application, you must make
146 sure to increment the version number of the current application. You must
147 increment both the <code>android:versionCode</code> and
148 <code>android:versionName</code> attributes of the <code>&lt;manifest&gt;</code>
149 element in the application's manifest file, using appropriate values. </p>
150
151 <p>For detailed information about how to define version information for your
152 application, see <a href="{@docRoot}guide/publishing/versioning.html">Versioning 
153 Your Applications</a>.</p>
154
155 <h3 id="cryptokey">7. Obtain a suitable cryptographic key</h3>
156
157 <p>If you have read and followed all of the preparation steps up to this point,
158 your application is compiled and ready for signing. Inside the .apk, the
159 application is properly versioned, and you've cleaned out extra files and
160 private data, as described above. </p>
161
162 <p>Before you sign your application, you need to make sure that you have a
163 suitable private key. For complete information about how to obtain (or generate)
164 a private key, see <a href="{@docRoot}guide/publishing/app-signing.html#cert">
165 Obtaining a Suitable Private Key</a>.</p>
166
167 <p>Once you have obtained (or generated) a suitable private key, you will use it
168 to:</p>
169
170 <ul>
171 <li>Register for a Maps API Key (see below), if your application uses MapView
172 elements.</li>
173 <li>Sign your application for release, later in the preparation process</li>
174 </ul>
175
176 <h3 id="mapsApiKey">8. Register for a Maps API Key, if your application is using
177 MapView elements</h3>
178
179 <div class="sidebox-wrapper">
180 <div class="sidebox"><p>
181 For complete information about getting a Maps API Key, see <a
182 href="http://code.google.com/android/add-ons/google-apis/mapkey.html">
183 Obtaining a Maps API Key</a>.</p>
184 </div>
185 </div>
186
187 <p>If your application uses one or more Mapview elements, you will need to 
188 register your application with the Google
189 Maps service and obtain a Maps API Key, before your MapView(s) will be able to
190 retrieve data from Google Maps. To do so, you supply an MD5 fingerprint of your
191 signer certificate to the Maps service. </p>
192
193 <p>During development, you can get a temporary Maps API Key by registering the
194 debug key generated by the SDK tools. However, before publishing your
195 application, you must register for a new Maps API Key that is based on your
196 private key. </p>
197
198 <p>If your application uses MapView elements, the important points to understand
199 are:</p>
200
201 <ol>
202 <li>You <em>must</em> obtain the Maps API Key before you compile your
203 application for release, because you must add the Key to a special attribute in
204 each MapView element &mdash; <code>android:apiKey</code> &mdash; in your
205 application's layout files. If you are instantiating MapView objects directly
206 from code, you must pass the Maps API Key as a parameter in the constructor.
207 </li>
208 <li>The Maps API Key referenced by your application's MapView elements must be
209 registered (in Google Maps) to the certificate used to sign the application.
210 This is particularly important when publishing your application &mdash; your
211 MapView elements must reference a Key that is registered to the release
212 certificate that you will use to sign your application.  </li>
213 <li>If you previously got a temporary Maps API Key by registering the debug
214 certificate generated by the SDK tools, you <em>must</em> remember to obtain a
215 new Maps API Key by registering your release certificate. You must then remember
216 to change the MapView elements to reference the new Key, rather than the Key
217 associated with the debug certificate. If you do not do so, your MapView
218 elements will not have permission to download Maps data. </li>
219 <li>If you change the private key that you will use to sign your application,
220 you <em>must</em> remember to obtain a new Maps API Key from the Google Maps
221 service. If you do not get a new Maps API Key and apply it to all MapView
222 elements, any MapView elements referencing the old Key will not have permission
223 to download Maps data. </li>
224 </ol>
225
226 <h2 id="compile">Compile your application</h2>
227
228 <p>When you've prepared your application as described in the previous sections,
229 you can compile your application for release.</p>
230
231
232 <h2 id="post-compile">After you compile your application</h2>
233
234 <h3 id="signapp">9. Sign your application</h3>
235
236 <p>Sign your application using your private key and then
237 align it with the {@code zipalign} tool. Signing your application
238 correctly is critically important. Please see
239 <a href="{@docRoot}guide/publishing/app-signing.html">Signing Your 
240 Applications</a> for complete information. </p>
241
242 <h3 id="testapp">10. Test your compiled and signed application</h3>
243
244 <p>Before you release your compiled application, you should thoroughly test it
245 on the target mobile device (and target network, if possible). In particular,
246 you should make sure that any MapView elements in your UI are receiving maps
247 data properly. If they are not, go back to <a href="#mapsApiKey">Register for a
248 Maps API Key</a> and correct the problem. You should also ensure that the
249 application works correctly with any server-side services and data that you are
250 providing or are relying on and that the application handles any authentication
251 requirements correctly.  </p>
252
253 <p>After testing, you are now ready to publish your application to mobile device
254 users.</p>
255
256