1page.title=Preparing to Publish: A Checklist 2@jd:body 3 4<p>Publishing an application means testing it, packaging it appropriately, and 5making it available to users of Android-powered mobile devices.</p> 6 7<p>If you plan to publish your application for installation on 8Android-powered devices, there are several things you need to do, to get 9your application ready. This document highlights the significant 10checkpoints 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 14href="{@docRoot}guide/publishing/publishing.html#market">Publishing on Android Market</a> 15for specific preparation requirements for your application. </p> 16 17<p>For general information about the ways that you can publish an applications, 18see the <a href="{@docRoot}guide/publishing/publishing.html">Publishing Your 19Applications</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 55many areas as possible. To help you do that, Android provides a variety of 56testing classes and tools. You can use 57{@link android.app.Instrumentation Instrumentation} to run JUnit and other 58test cases, and you can use testing 59tools such as the <a href="{@docRoot}guide/developing/tools/monkey.html">UI/Application 60Exerciser Monkey</a>. </p> 61 62<ul> 63<li>To ensure that your application will run properly for users, you should make 64every effort to obtain one or more physical mobile device(s) of the type on 65which you expect the application to run. You should then test your application 66on the actual device, under realistic network conditions. Testing your 67application on a physical device is very important, because it enables you to 68verify that your user interface elements are sized correctly (especially for 69touch-screen UI) and that your application's performance and battery efficiency 70are acceptable.</li> 71 72<li>If you can not obtain a mobile device of the type you are targeting for your 73application, 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 76emulator's screen, network performance, and other attributes to match the target 77device to the greatest extent possible. You can then test your application's UI 78and performance. However, we strongly recommend that you test your application 79on 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 82G1</a> device for your application, make sure that your UI handles screen 83orientation changes. </li> 84</ul> 85 86<h3 id="eula">2. Consider adding an End User License Agreement in your 87application</h3> 88 89<p>To protect your person, organization, and intellectual property, you may want 90to provide an End User License Agreement (EULA) with your application. 91 92<h3>3. Consider adding support for Android Market Licensing</h3> 93 94<p>If you are publishing a paid application through Android Market, consider 95adding support for Android Market Licensing. Licensing lets you control access 96to your application based on whether the current user has purchased it. 97Using Android Market Licensing is optional. 98 99<p>For complete information about Android Market Licensing Service and how to 100use it in your application, see <a 101href="{@docRoot}guide/publishing/licensing.html">Licensing Your 102Applications</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 107important because they are displayed to users as your application's icon and 108name. They are displayed on the device's Home screen, as well as in Manage 109Applications, My Downloads, and elsewhere. Additionally, publishing services may 110display 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><application></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 117as 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 122that debug and other unnecessary data/files are removed from your application 123project.</p> 124<ul> 125<li>Remove the <code>android:debuggable="true"</code> attribute from the 126<code><application></code> element of the manifest.</li> 127<li>Remove log files, backup files, and other unnecessary files from the 128application 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 131code.</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 139a version number for your application, specifying an appropriate value for both 140the <code>android:versionCode</code> and <code>android:versionName</code> 141attributes of the <code><manifest></code> element in the application's 142manifest file. Carefully consider your version numbering plans in the context of 143your overall application upgrade strategy. </p> 144 145<p>If you have previously released a version of your application, you must make 146sure to increment the version number of the current application. You must 147increment both the <code>android:versionCode</code> and 148<code>android:versionName</code> attributes of the <code><manifest></code> 149element in the application's manifest file, using appropriate values. </p> 150 151<p>For detailed information about how to define version information for your 152application, see <a href="{@docRoot}guide/publishing/versioning.html">Versioning 153Your 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, 158your application is compiled and ready for signing. Inside the .apk, the 159application is properly versioned, and you've cleaned out extra files and 160private data, as described above. </p> 161 162<p>Before you sign your application, you need to make sure that you have a 163suitable private key. For complete information about how to obtain (or generate) 164a private key, see <a href="{@docRoot}guide/publishing/app-signing.html#cert"> 165Obtaining a Suitable Private Key</a>.</p> 166 167<p>Once you have obtained (or generated) a suitable private key, you will use it 168to:</p> 169 170<ul> 171<li>Register for a Maps API Key (see below), if your application uses MapView 172elements.</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 177MapView elements</h3> 178 179<div class="sidebox-wrapper"> 180<div class="sidebox"><p> 181For complete information about getting a Maps API Key, see <a 182href="http://code.google.com/android/add-ons/google-apis/mapkey.html"> 183Obtaining 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 188register your application with the Google 189Maps service and obtain a Maps API Key, before your MapView(s) will be able to 190retrieve data from Google Maps. To do so, you supply an MD5 fingerprint of your 191signer certificate to the Maps service. </p> 192 193<p>During development, you can get a temporary Maps API Key by registering the 194debug key generated by the SDK tools. However, before publishing your 195application, you must register for a new Maps API Key that is based on your 196private key. </p> 197 198<p>If your application uses MapView elements, the important points to understand 199are:</p> 200 201<ol> 202<li>You <em>must</em> obtain the Maps API Key before you compile your 203application for release, because you must add the Key to a special attribute in 204each MapView element — <code>android:apiKey</code> — in your 205application's layout files. If you are instantiating MapView objects directly 206from 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 209registered (in Google Maps) to the certificate used to sign the application. 210This is particularly important when publishing your application — your 211MapView elements must reference a Key that is registered to the release 212certificate that you will use to sign your application. </li> 213<li>If you previously got a temporary Maps API Key by registering the debug 214certificate generated by the SDK tools, you <em>must</em> remember to obtain a 215new Maps API Key by registering your release certificate. You must then remember 216to change the MapView elements to reference the new Key, rather than the Key 217associated with the debug certificate. If you do not do so, your MapView 218elements 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, 220you <em>must</em> remember to obtain a new Maps API Key from the Google Maps 221service. If you do not get a new Maps API Key and apply it to all MapView 222elements, any MapView elements referencing the old Key will not have permission 223to 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, 229you 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 237align it with the {@code zipalign} tool. Signing your application 238correctly is critically important. Please see 239<a href="{@docRoot}guide/publishing/app-signing.html">Signing Your 240Applications</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 245on the target mobile device (and target network, if possible). In particular, 246you should make sure that any MapView elements in your UI are receiving maps 247data properly. If they are not, go back to <a href="#mapsApiKey">Register for a 248Maps API Key</a> and correct the problem. You should also ensure that the 249application works correctly with any server-side services and data that you are 250providing or are relying on and that the application handles any authentication 251requirements correctly. </p> 252 253<p>After testing, you are now ready to publish your application to mobile device 254users.</p> 255 256 257