4 years ago (2015-08-22)  Software development |   First to comment  10 
post score 0 times, average 0.0

Android: versionCode and android: versionName

In eclipse, to modify the version number of our application, you only need to add the android:versionCode and android:versionName values ​​to the manifest tag in the manifest file AndroidManifest.xml to set the application version number.As the following code:

The above code indicates that the package name of the application is cn.wangbaiyuan.translate, the version number is code:2, and the version name is Name:1.1; the former is generally for the developer to compare whether the version is upgraded, and the latter is displayed for the user to see. androidStudio development Android application setting version number Using Eclipse to modify the AndroidManifest.xml to modify the version number is completely fine, but Extreme Guest tried to modify only the AndroidManifest.xml content in Android Studio. It didn't work. Although I assigned android:versionName to 1.1, it was on the phone. The version number shown is always the previous 1.0.

androidStudio development Android application setting version number

It was later discovered that the build.gradle(Module:app) configuration file in Android Studio also set its version number. In the case of a conflict with the version number filled in AndroidManifest.xml, the compiled APK uses build.gradle(Module). :app) configuration: build.gradle(Module:app)

Solution

Find the build.gradle(Module:app) file in the project folder, delete the two lines of defaultCode inside VersionCode and VersionName; or directly modify the version number here.

 

This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!

Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/set-version-number-androidstudio-developing-android-applications-2.html

Post comment

Style

No Comment

登录

Forget password?

您也可以使用第三方帐号快捷登录

切换登录

注册

TW