android 开发中获取versionName和versionCode
2016-09-07 13:37
267 查看
android studio中gradle文件和manifest中都有对于versionName和versionCode的配置。
经过实践发现使用PocketManager get PocketInfo中的versionName是gradle配置的,查阅官方文档发现gradle中的配置在build的时候会覆盖manifest中的。
To define the version information for your app, set values for the version settings in the Gradle build files. These values are then merged into your app's manifest file during the build process.
Note: If your app defines the app version directly in the
build files allows you to specify different values for different versions of your app. For greater flexibility and to avoid potential overwriting when the manifest is merged, you should remove these attributes from the
and define your version settings in the Gradle build files instead.
Two settings are available, and you should always define values for both of them:
所以可以删除manifest中的配置,直接使用gradle中的配置。
经过实践发现使用PocketManager get PocketInfo中的versionName是gradle配置的,查阅官方文档发现gradle中的配置在build的时候会覆盖manifest中的。
To define the version information for your app, set values for the version settings in the Gradle build files. These values are then merged into your app's manifest file during the build process.
Note: If your app defines the app version directly in the
<manifest>element, the version values in the Gradle build file will override the settings in the manifest. Additionally, defining these settings in the Gradle
build files allows you to specify different values for different versions of your app. For greater flexibility and to avoid potential overwriting when the manifest is merged, you should remove these attributes from the
<manifest>element
and define your version settings in the Gradle build files instead.
Two settings are available, and you should always define values for both of them:
所以可以删除manifest中的配置,直接使用gradle中的配置。
相关文章推荐
- Android 获取AndroidManifest.xml文件versionCode,versionName属性
- android获取versionName和versionCode
- Android 获取AndroidManifest.xml文件versionCode,versionName属性 .
- Android Studio获取app的versionName和versionCode
- Android 获取AndroidManifest.xml文件versionCode,versionName属性
- android开发中关于VersionCode和VersionName
- Android 获取到的 VersionName 和 VersionCode 一直是1.0 和 1
- Android Studio获取当前软件的版本号(versionCode)和版本名称(versionName)
- Android 获取AndroidManifest 文件 versionCode和versionName属性
- 【Android Studio开发】Android Studio如何获取versionname和versioncode
- 获取APP版本号:versionName、versionCode---Android基础篇
- Android 获取包名,版本信息及VersionName名称
- Android开发之VersionCode和VersionName知识
- Android VersionName 一直是1.0 VersionCode 一直是1 的问题
- 关于android发布版本时,versioncode和versionname区别
- Android 获取包名,版本信息及VersionName名称
- [Android Pro] Android打包一个Apk后,如何查看它的VersionCode、VersionName 等等。
- Android 获取包名,版本信息及VersionName名称
- Android打包一个Apk后,如何查看它的VersionCode、VersionName 等等。
- Android VersionCode和VersionName的作用