1page.title=Preparing to Publish: A Checklist 2@jd:body 3 4<!-- 5<div id="qv-wrapper"> 6<div id="qv"> 7 8<h2>In this document</h2> 9 10<ol> 11<li><a href=""></a></li> 12</ol> 13 14</div> 15</div> 16--> 17 18<p>Publishing an application means testing it, packaging it appropriately, and 19making it available to users of Android-powered mobile devices.</p> 20 21<p>If you plan to publish your application for installation on 22Android-powered devices, there are several things you need to do, to get 23your application ready. This document highlights the significant 24checkpoints for preparing your application for a successful release. 25</p> 26 27<p>If you will publish your application on Android Market, please also see <a 28href="{@docRoot}guide/publishing/publishing.html#market">Publishing on Android Market</a> 29for specific preparation requirements for your application. </p> 30 31<p>For general information about the ways that you can publish an applications, 32see the <a href="{@docRoot}guide/publishing/publishing.html">Publishing Your 33Applications</a> document. </p> 34 35<div class="special"> 36 37<p>Before you consider your application ready for release:</p> 38 39<ol> 40<li>Test your application extensively on an actual device </li> 41<li>Consider adding an End User License Agreement in your application</li> 42<li>Specify an icon and label in the application's manifest</li> 43<li>Turn off logging and debugging and clean up data/files</li> 44</ol> 45 46<p>Before you do the final compile of your application:</p> 47 48<ol start="5"> 49<li>Version your application</li> 50<li>Obtain a suitable cryptographic key</li> 51<li>Register for a Maps API Key, if your application is using MapView elements</li> 52</ol> 53 54<p><em>Compile your application...</em></p> 55<p>After compiling your application:</p> 56<ol start="8"> 57<li>Sign your application</li> 58<li>Test your compiled application</li> 59</ol> 60</div> 61 62<h2 id="releaseready">Before you consider your application ready for release</h2> 63 64<h3 id="test">1. Test your application extensively on an actual device</h3> 65 66<p>It's important to test your application as extensively as possible, in as 67many areas as possible. To help you do that, Android provides a variety of 68testing classes and tools. You can use 69{@link android.app.Instrumentation Instrumentation} to run JUnit and other 70test cases, and you can use testing 71tools such as the <a href="{@docRoot}guide/developing/tools/monkey.html">UI/Application 72Exerciser Monkey</a>. </p> 73 74<ul> 75<li>To ensure that your application will run properly for users, you should make 76every effort to obtain one or more physical mobile device(s) of the type on 77which you expect the application to run. You should then test your application 78on the actual device, under realistic network conditions. Testing your 79application on a physical device is very important, because it enables you to 80verify that your user interface elements are sized correctly (especially for 81touch-screen UI) and that your application's performance and battery efficiency 82are acceptable.</li> 83 84<li>If you can not obtain a mobile device of the type you are targeting for your 85application, you can use emulator options such as <code>-dpi</code>, 86<code>-device</code>, <code>-scale</code>, <code>-netspeed</code>, 87<code>-netdelay</code>, <code>-cpu-delay</code> and others to model the 88emulator's screen, network performance, and other attributes to match the target 89device to the greatest extent possible. You can then test your application's UI 90and performance. However, we strongly recommend that you test your application 91on an actual target device before publishing it. </li> 92 93<li>If you are targeting the <a href="http://www.t-mobileg1.com/">T-Mobile 94G1</a> device for your application, make sure that your UI handles screen 95orientation changes. </li> 96</ul> 97 98<h3 id="eula">2. Consider adding an End User License Agreement in your 99application</h3> 100 101<p>To protect your person, organization, and intellectual property, you may want 102to provide an End User License Agreement (EULA) with your application. 103 104<h3 id="iconlabel">3. 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">4. 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">5. 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">6. 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">7. Register for a Maps API Key, if your application is using 177MapView elements</h3> 178 179<div class="sidebox" style="margin-bottom:.5em;padding:1em;"><p> 180For complete information about getting a Maps API Key, see <a 181href="http://code.google.com/android/add-ons/google-apis/mapkey.html"> 182Obtaining a Maps API Key</a>.</p></div> 183 184<p>If your application uses one or more Mapview elements, you will need to 185register your application with the Google 186Maps service and obtain a Maps API Key, before your MapView(s) will be able to 187retrieve data from Google Maps. To do so, you supply an MD5 fingerprint of your 188signer certificate to the Maps service. </p> 189 190<p>During development, you can get a temporary Maps API Key by registering the 191debug key generated by the SDK tools. However, before publishing your 192application, you must register for a new Maps API Key that is based on your 193private key. </p> 194 195<p>If your application uses MapView elements, the important points to understand 196are:</p> 197 198<ol> 199<li>You <em>must</em> obtain the Maps API Key before you compile your 200application for release, because you must add the Key to a special attribute in 201each MapView element — <code>android:apiKey</code> — in your 202application's layout files. If you are instantiating MapView objects directly 203from code, you must pass the Maps API Key as a parameter in the constructor. 204</li> 205<li>The Maps API Key referenced by your application's MapView elements must be 206registered (in Google Maps) to the certificate used to sign the application. 207This is particularly important when publishing your application — your 208MapView elements must reference a Key that is registered to the release 209certificate that you will use to sign your application. </li> 210<li>If you previously got a temporary Maps API Key by registering the debug 211certificate generated by the SDK tools, you <em>must</em> remember to obtain a 212new Maps API Key by registering your release certificate. You must then remember 213to change the MapView elements to reference the new Key, rather than the Key 214associated with the debug certificate. If you do not do so, your MapView 215elements will not have permission to download Maps data. </li> 216<li>If you change the private key that you will use to sign your application, 217you <em>must</em> remember to obtain a new Maps API Key from the Google Maps 218service. If you do not get a new Maps API Key and apply it to all MapView 219elements, any MapView elements referencing the old Key will not have permission 220to download Maps data. </li> 221</ol> 222 223<h2 id="compile">Compile your application</h2> 224 225<p>When you've prepared your application as described in the previous sections, 226you can compile your application for release.</p> 227 228 229<h2 id="post-compile">After compiling your application</h2> 230 231<h3 id="signapp">8. Sign your application</h3> 232 233<p>Sign your application using your private key and then 234align it with the {@code zipalign} tool. Signing your application 235correctly is critically important. Please see 236<a href="{@docRoot}guide/publishing/app-signing.html">Signing Your 237Applications</a> for complete information. </p> 238 239<h3 id="testapp">9. Test your compiled and signed application</h3> 240 241<p>Before you release your compiled application, you should thoroughly test it 242on the target mobile device (and target network, if possible). In particular, 243you should make sure that any MapView elements in your UI are receiving maps 244data properly. If they are not, go back to <a href="#mapsApiKey">Register for a 245Maps API Key</a> and correct the problem. You should also ensure that the 246application works correctly with any server-side services and data that you are 247providing or are relying on and that the application handles any authentication 248requirements correctly. </p> 249 250<p>After testing, you are now ready to publish your application to mobile device 251users.</p> 252 253 254