zoukankan      html  css  js  c++  java
  • 发布版本化您的应用

    版本化您的应用

    版本控制是一个非常重要的概念,在应用升级和维护的时候非常有用。版本控制的重要性因为:

    Versioning is a critical component of your application upgrade and maintenancestrategy. Versioning is important because:

    • Users need to have specific information about the application version that is installed on their devices and the upgrade versions available forinstallation.
    • Other applications — including other applications that you publish asa suite — need to query the system for your application's version, to determine compatibility and identify dependencies.
    • Services through which you will publish your application(s) may also need to query your application for its version, so that they can display the version to users. A publishing service may also need to check the application version to determine compatibility and establish upgrade/downgrade relationships.

    The Android system does not use app version information to enforce restrictions on upgrades, downgrades, or compatibility of third-party apps. Instead, you (thedeveloper) are responsible for enforcing version restrictions within your application or by informing users of the version restrictions and limitations. The Android system does, however,enforce system version compatibility as expressed by the minSdkVersion attribute in themanifest. This attribute allows an application to specify the minimum system API with which it iscompatible. For more information see Specifying Minimum System APIVersion.

    Setting Application Version(设置应用版本)


    To define the version information for your application, you set attributes in the application's manifest file. Two attributes are available, and you should always define values for both of them:

    • android:versionCode — An integer value that representsthe version of the application code, relative to other versions.

      The value is an integer so that other applications can programmatically evaluate it, for example to check an upgrade or downgrade relationship. You can set the value to any integer you want, however you should make sure that each successive release of your application uses a greater value. The system does not enforce this behavior, but increasing the value with successive releases is normative.

      Typically, you would release the first version of your application with versionCode set to 1, then monotonically increase the value with each release,regardless whether the release constitutes a major or minor release. This means that the android:versionCode value does not necessarily have a strong resemblance to the application release version that is visible to the user (see android:versionName, below). Applications and publishing services should not display this version value to users.

    • android:versionName — A string value that represents the release version of the application code, as it should be shown to users.

      The value is a string so that you can describe the application version as a<major>.<minor>.<point> string, or as any other type ofabsolute or relative version identifier.

      As with android:versionCode, the system does not use this value for any internal purpose, other than to enable applications to display it tousers. Publishing services may also extract the android:versionName value for display to users.

    You define both of these version attributes in the<manifest> element of the manifest file.

    Here's an example manifest that shows the android:versionCode and android:versionName attributes in the<manifest> element.

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.package.name"
          android:versionCode="2"
          android:versionName="1.1">
        <application android:icon="@drawable/icon" android:label="@string/app_name">
            ...
        </application>
    </manifest>

    In this example, note that android:versionCode value indicates that the current .apk contains the second release of the application code, which corresponds to a minor follow-on release, as shown by the android:versionName string.

    The Android framework provides an API to let applications query the systemfor version information about your application. To obtain version information,applications use thegetPackageInfo(java.lang.String, int)method of PackageManager.

    Specifying Your Application's System API Requirements(指定应用能运行的系统API)


    If your application requires a specific minimum version of the Androidplatform, or is designed only to support a certain range of Android platformversions, you can specify those version requirements as API Level identifiersin the application's manifest file. Doing so ensures that your application can only be installed on devices that are running a compatible version of the Android system.

    To specify API Level requirements, add a <uses-sdk>element in the application's manifest, with one or more of these attributes:

    • android:minSdkVersion — The minimum versionof the Android platform on which the application will run, specifiedby the platform's API Level identifier.
    • android:targetSdkVersion — Specifies the API Levelon which the application is designed to run. In some cases, this allows theapplication to use manifest elements or behaviors defined in the targetAPI Level, rather than being restricted to using only those definedfor the minimum API Level.
    • android:maxSdkVersion — The maximum versionof the Android platform on which the application is designed to run,specified by the platform's API Level identifier. Important: Please read the <uses-sdk>documentation before using this attribute.

    When preparing to install your application, the system checks the value of this attribute and compares it to the system version. If the android:minSdkVersion value is greater than the system version, the system aborts the installation of the application. Similarly, the systeminstalls your application only if its android:maxSdkVersionis compatible with the platform version.

    If you do not specify these attributes in your manifest, the system assumesthat your application is compatible with all platform versions, with nomaximum API Level.

    To specify a minimum platform version for your application, add a<uses-sdk> element as a child of<manifest>, then define the android:minSdkVersion as an attribute.

    For more information, see the <uses-sdk>manifest element documentation and the API Levels document.

  • 相关阅读:
    学习GlusterFS(二)
    并不对劲的莫比乌斯反演
    并不对劲的WC2019
    并不对劲的loj2134:uoj132:p2304:[NOI2015]小园丁与老司机
    并不对劲的bzoj3626:loj2558:p4211:[LNOI2014]LCA
    并不对劲的bzoj3214:p3333:[ZJOI2013]丽洁体
    并不对劲的bzoj4827:loj2020:p3723:[AHOI/HNOI2017]礼物
    并不对劲的bzoj4560:p3269:[JLOI2016]字符串覆盖
    并不对劲的p2664树上游戏
    并不对劲的p3709:大爷的字符串题
  • 原文地址:https://www.cnblogs.com/java20130722/p/3207295.html
Copyright © 2011-2022 走看看