zoukankan      html  css  js  c++  java
  • Preparing for Release(发布前的准备)

    发布前的准备

    在发布之前,有些准备工作要做。开发工作是所有过程中的第一个步骤。

    当您准备发布您的应用,配置,构建,和测试一个将要发布的应用。配置工作是直截了当地,包括清理代码和代码修改,为了优化应用。构建构成与调试过程很类似,可以通过JDK和android SDK工具做到。测试是最后的检查工作,可以保证应用能在真是的环境中正常的运行。当应用准备好并且签名之后,就可以直接发布到应用市场中(google play)。


    Shows how the preparation process fits into the development process

    Figure 1. Preparing for release is a requireddevelopmenttask and is the first step in the publishing process.

    简介


    为了用户可以安装,运行您的应用,应用必须要创建release-ready package。release-ready package 包括同样的调试apk文件,编译代码,资源文件,manifest文件,等等。用相同的构建工具构建应用。当然不是调试apk文件,是用私有密钥签名的apk文件。

    Shows the five tasks you perform to prepare your app for release

    签名和优化任务通常是相辅相成,当您通过eclipse 和ADT插件或者Ant 脚本(包括android SDK)构建您的应用.例如,您可以通过eclipse工具编译和优化您的应用,还可以用ant脚本从命令行做同样的事情。

    准备发布的应用有五个典型的任务。每个典型的任务可能包含一个或者更多小的任务,这个要看您怎么发布您的应用。例如,当您通过google play发布应用,当您设置将要发布的应用的时候,您可能会在manifest文件中添加特殊的过滤规则。同样的,为了满足google play的要求,您需要准备必须的材料。

    准备材料和资源


    To begin preparing your application for release you need to gather several supporting items. At aminimum this includes cryptographic keys for signing your application and an application icon. Youmight also want to include an end-user license agreement.

    Cryptographic keys(私有密钥)

    The Android system requires that each installed application be digitally signed with acertificate that is owned by the application's developer (that is, a certificate for which thedeveloper holds the private key). The Android system uses the certificate as a means of identifyingthe author of an application and establishing trust relationships between applications. Thecertificate that you use for signing does not need to be signed by a certificate authority; theAndroid system allows you to sign your applications with a self-signed certificate. To learn aboutcertificate requirements, see Obtain asuitable private key.

    Important: Your application must be signed with a cryptographickey whose validity period ends after 22 October 2033.

    You may also have to obtain other release keys if your application accesses a service or uses athird-party library that requires you to use a key that is based on your private key. For example,if your application uses theMapViewclass, which is part of the Google Maps externallibrary, you will need to register your application with the Google Maps service and obtaina Maps API key. For information about getting a Maps API key, seeObtaining a Maps APIkey.

    Application Icon(应用图标)

    Be sure you have an application icon and that it meets the recommended icon guidelines. Yourapplication's icon helps users identify your application on a device's Homescreen and in the Launcher window. It also appears in Manage Applications, My Downloads, andelsewhere. In addition, publishing services such as Google Play display your icon to users.

    Note: If you are releasing your application on Google Play, youneed to create a high resolution version of your icon. SeeGraphicAssets for your Application for more information.

    End-user License Agreement(用户许可证协议)

    Consider preparing an End User License Agreement (EULA) for your application. A EULA can helpprotect your person, organization, and intellectual property, and we recommend that you provide onewith your application.

    Miscellaneous Materials(其他材料)

    You might also have to prepare promotional and marketing materials to publicize your application.For example, if you are releasing your application on Google Play you will need to prepare somepromotional text and you will need to create screenshots of your application. For moreinformation, seeGraphic Assets for your Application

    配置应用


    After you gather all of your supporting materials you can start configuring your applicationfor release. This section provides a summary of the configuration changes we recommend that you make to your source code, resource files, and application manifest prior to releasing your application.Although most of the configuration changes listed in this section are optional, they areconsidered good coding practices and we encourage you to implement them. In some cases,you may have already made these configuration changes as part of your development process.

    Choose a good package name(选择好的包名)

    Make sure you choose a package name that is suitable over the life of your application. Youcannot change the package name after you distribute your application to users. You can set thepackage name in application's manifest file. For more information, see the package attributedocumentation.

    Turn off logging and debugging(去掉日志和调试)

    Make sure you deactivate logging and disable the debugging option before you build yourapplication for release. You can deactivate logging by removing calls toLog methods in your source files. You can disable debugging by removing theandroid:debuggable attribute from the<application> tag in yourmanifest file, or by setting the android:debuggable attribute tofalse in your manifest file. Also, remove any log files or static test files thatwere created in your project.

    Also, you should remove all Debug tracing calls that youadded to your code, such asstartMethodTracing() andstopMethodTracing() method calls.

    Clean up your project directories(清理项目目录)

    Clean up your project and make sure it conforms to the directory structure described inAndroid Projects.Leaving stray or orphaned files in your project can prevent your application from compiling andcause your application to behave unpredictably. At a minimum you should do the following cleanuptasks:

    • Review the contents of your jni/, lib/, and src/ directories. Thejni/ directory should contain only source files associated with the Android NDK, such as .c, .cpp, .h, and.mk files. The lib/ directory should contain only third-party library files or private library files, including prebuilt shared and static libraries (for example,.so files). The src/ directory should contain only the source files for your application (.java and.aidl files). The src/ directory should not contain any.jar files.
    • Check your project for private or proprietary data files that your application does not use and remove them. For example, look in your project'sres/ directory for old drawable files, layout files, and values files that you are no longer using and delete them.
    • Check your lib/ directory for test libraries and remove them if they are no longer being used by your application.
    • Review the contents of your assets/ directory and your res/raw/ directory for raw asset files and static files that you need to update or remove prior to release.

    Review and update your manifest settings(重审和更新manifest 设置)

    Verify that the following manifest items are set correctly:

    • <uses-permission> element

      You should specify only those permissions that are relevant and required for your application.

    • android:icon and android:label attributes

      You must specify values for these attributes, which are located in the <application> element.

    • android:versionCode and android:versionName attributes.

      We recommend that you specify values for these attributes, which are located in the<manifest> element. For more information see Versioning your Application.

    There are several additional manifest elements that you can set if you are releasing yourapplication on Google Play. For example, theandroid:minSdkVersion andandroid:targetSdkVersion attributes, which are located in the<uses-sdk> element. For moreinformation about these and other Google Play settings, seeFilters on Google Play.

    Address compatibility issues(解决兼容性问题)

    Android provides several tools and techniques to make your application compatible with a widerange of devices. To make your application available to the largest number of users, considerdoing the following:

    • Add support for multiple screen configurations(添加支持多种屏幕适配)

      Make sure you meet the best practices for supporting multiple screens. By supporting multiple screen configurations you can create an application that functions properly and looks good on any of the screen sizes supported by Android.

    • Optimize your application for Android tablet devices.(优化平板应用)

      If your application is designed for devices older than Android 3.0, make it compatible with Android 3.0 devices by following the guidelines and best practices described inOptimizing Apps for Android 3.0.

    • Consider using the Support Library(使用支持库)

      If your application is designed for devices running Android 3.x, make your application compatible with older versions of Android by adding theSupport Library to your application project. The Support Library provides static support libraries that you can add to your Android application, which enables you to use APIs that are either not available on older platform versions or use utility APIs that are not part of the framework APIs.

    Update URLs for servers and services(更新服务器和服务的URL)

    If your application accesses remote servers or services, make sure you are using the productionURL or path for the server or service and not a test URL or path.

    Implement Licensing (if you are releasing on Google Play)

    If you are releasing a paid application through Google Play, consider adding support forGoogle Play Licensing. Licensing lets you control access to your application based on whether thecurrent user has purchased it. Using Google Play Licensing is optional even if you arereleasing your app through Google Play.

    For more information about Google Play Licensing Service and how to use it in yourapplication, seeApplication Licensing.

    Building Your Application for Release(构建应用)


    After you finish configuring your application you can build it into a release-ready.apk fle that is signed and optimized. The JDK includes the tools for signing the.apk file (Keytool and Jarsigner); the Android SDK includes the tools for compiling andoptimizing the .apk file. If you are using Eclipse with the ADT plugin or you are usingthe Ant build script from the command line, you can automate the entire build process.

    Building with Eclipse

    You can use the Eclipse Export Wizard to build a release-ready .apk file that issigned with your private key and optimized. To learn how to run the Export Wizard, seeCompile and sign with EclipseADT. The Export Wizard compiles your application for release, signs your application with yourprivate key, and optimizes your application with the zipalign tool. The Export Wizard should runsuccessfully if you have run or debugged your application from Eclipse and you have no errors inyour application (see Buildingand Running from Eclipse with ADT for more information.

    The Export Wizard assumes that you have a certificate and private keysuitable for signing your application. If you do not have a suitable certificate and private key,the Export Wizard will help you generate one (seeSigning Your Applications for moreinformation about the signing process and signing guidelines.

    Building with Ant

    You can use the Ant build script (included in the Android SDK) to build a release-ready.apk file that is signed with your private key and optimized. To learn how to do this,seeBuilding inRelease Mode. This build method assumes you have a certificate andprivate key suitable for signing your application. If you do not have a suitable certificate andprivate key, the Export Wizard will help you generate one (seeSigning Your Applications for moreinformation about the signing process and signing guidelines.

    Preparing External Servers and Resources


    If your application relies on a remote server, make sure the server is secure and that it isconfigured for production use. This is particularly important if you are implementingin-app billing in your application and you areperforming the signature verification step on a remote server.

    Also, if your application fetches content from a remote server or a real-time service (such as acontent feed), be sure the content you are providing is up to date and production-ready.

    Testing Your Application for Release


    Testing the release version of your application helps ensure that your application runs properlyunder realistic device and network conditions. Ideally, you should test your application on at leastone handset-sized device and one tablet-sized device to verify that your user interface elements aresized correctly and that your application's performance and battery efficiency are acceptable.

    As a starting point for testing, seeWhat to Test. This article providesa summary of common Android situations that you should consider when you are testing. When you aredone testing and you are satisfied that the release version of your applicationbehaves correctly, you can release your application to users. For more information, seeReleasing YourApplication to Users. If you are publishing your application on Google Play, seePublishing Checklistfor Google Play.

  • 相关阅读:
    【吐血整理】SVN命令行,Subversion的正确使用姿势,让版本控制更简单~
    【踩坑速记】MIUI系统BUG,调用系统相机拍照可能会带给你的一系列坑,将拍照适配方案进行到底!
    【福利大放送】不止是Android,Github超高影响力开源大放送,学习开发必备教科书
    【开发必备】今天我们来谈谈Android NDK动态链接库(so文件)的一些见解
    【使用教程】论Windows下必备的抓包工具Fiddler2如何安装证书(查看Https)
    【年终总结】我的2016,阅读本文大约需要一整年
    【知识必备】一文让你搞懂design设计的CoordinatorLayout和AppbarLayout联动,让Design设计更简单~
    【踩坑速记】开源日历控件,顺便全面解析开源库打包发布到Bintray/Jcenter全过程(新),让开源更简单~
    【知识必备】ezSQL,最好用的数据库操作类,让php操作sql更简单~
    Hive 8、Hive2 beeline 和 Hive jdbc
  • 原文地址:https://www.cnblogs.com/java20130722/p/3207360.html
Copyright © 2011-2022 走看看