Reprint Please specify source http://blog.csdn.net/y150481863/article/details/41249159, from "http://blog.csdn.net/y150481863"
When we first started to learn Android, we probably didn't pay much attention to the Versioncode and Versionname in the Manifest.xml file.
But in fact a good version of control, for us has a vital role.
Now intend to write something basic, suddenly think of this knowledge point, so on record down, as notes. There are not enough detailed or wrong places to welcome advice.
Versioning is critical for releasing new releases and maintenance of versions in development, and versioning is important for the following reasons:
1. When installing the app, users need to know the detailed version information, and when the existing version is upgraded, the correct installation of the new version is related to version control .
For example: When the app's versioncode=1 is installed on the phone, the version number of the upgrade update is 2 (versioncode=2), and the app can install the update properly. Conversely, if the current app version number in the phone is 2, the version number of the same app that is upgraded or obtained from another channel is 1, then the replacement installation fails.
This means that the same app's low version does not directly overwrite the high-version app that already exists in the installed phone (judged by version number (Versioncode)).
This gives us an improved maintainability and security of the software during the application upgrade maintenance process.
2. There is a reliable guarantee for other applications that want to search for or invoke the specified version number and version name.
When we publish multiple versions of the app on the market, such as different versions of the different types of terminals, we can use version control to find the right app.
3. For our own version of the update system or third-party app market, also through the version number and version name to find and user terminal equipment or the application of the Terminal app to show to the user. For the third-party app market, this version is even more critical, the decision to download the user after the compatibility of the judgment play a certain role in control.
So versioning cannot be overlooked, and we can control the applications we post to the market with effective versioning to get a better user experience.
How to set the version number and version name of your app, here's a quick introduction. Versioncode -------According to the above description, the version number (Versioncode) is a relatively important property. Versioncode is a value of type integer. So when you set the time, do not set the versioncode too large, it is best not to exceed the value of the integer range (of course, will not exceed), General people in the release of their first application to the market, the version value is 1 (versioncode=1), This is also the current typical and common practice. Then, you can increment the value of Versioncode each time you publish an updated version. As described in the above description of versioning importance, a new version of the app's versioncode cannot be less than the previous version of the Versioncode value, or the replacement update upgrade will be an error, the system prompts cannot be installed. This is not mandatory, of course, but it is a question that must be considered when the application is officially released. Versionname------This is a property with a value of type string, and the general and Versioncode appear in pairs. Versioncode is a valid value set for the convenience of program developers to run and maintain application. Versionname is a version of the description, to the user to see, but also the user placed on each 3rd party platform to provide users with a version of the name, can be said to Versioncode interpretation and description. The general format can be: 1.1.2 (major.minor.point) Form. Here is an example of a manifest.xml file:
The above code indicates that the current. APK is the second version, with the Versionname value of 1.1 to see that this version is an optimized retrofit version on the 1.0 version, the difference and the 1.0 version are small. If it is a UI style or a business logic with a larger adjustment of the application, the version will generally rise to a level, such as should be defined as 2.0
- Major is the major version number, typically growing when software has a major upgrade
- Minor is the minor version number, which generally grows when the software has new features
- Maintenance is a maintenance release, generally growing after the software has major problem fixes
- Build is built, and usually grows if the software is recompiled
Introduction to the importance of Android version number and version name