Do we really need to include android:versionCode
and android:versionName
in AndroidManifest.xml
?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.application"
android:versionCode="1"
android:versionName="1.0.0">
These values are indicated in my App/build.gradle under defaultConfig
. I see no value in putting them in AndroidManifest. The argument I received from colleague was, this value will be shown later in AppInfo when user tap into it.
According to Android docs, I don't see any highlight about settings these in Android Manifest either.
As described in the official doc:
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.