I've searched through stackoverflow and this doesn't seem to be a duplicate question, so please notify me if it has already been asked. I've made a second version of an app and I was wondering if there was a naming convention for the app versions. In my gradle, I've changed the values of versionCode and versionName to
versionCode 2
versionName "1.0.2"
Is this the right convention? Is there even a convention? Does versionCode have to be an integer? Is 1.02 or 1.0.02 acceptable? And does it have to be by increments of 1(i.e. can I jump straight to 1.7 on the second update)?(sorry for all the questions, I wanted to get all of it at once.)
versionCode have to be integer, and it is used for android to keep track of which apk is latest, e.g. in Google Play, you can upload your apk if your new apk has versionCode larger than that of the apk you previously uploaded.
versionName is for display only, and communication with user, it is up to you to define it. I.e. no restriction
There are no literal restrictions on either, just their data types:
versionCode can be any integer and versionName can be any string.
However, Android uses the versionCode to tell which builds are more recent - and doesn't let users install an apk if the versionCode of the apk to install is less than the versionCode of the apk already installed.
Therefore version code changes should always be to larger numbers - though the how much larger is technically irrelevant.
versionName is for display purposes only. It could be set to "v1.43 - blueVersion attempt4".
A common naming conversion is to label each release version major.minor.fix in the version name, and then reflect it in the version code. e.g. v "2.3.11" becomes version code 20311. which could be followed by v"3.0.0" = code 30000.
Related
I'm trying to deploy our Nativescript app to the Google Play Store using a YML pipeline in Azure DevOps. There is a deployment task that automatically increases the versionCode and versionNumber, which always used to work fine.
However now that we upload, I get this error:
##[error]Error: Failed to upload the bundle /Users/runner/work/1/_Android/app-release.aab. Failed with message:
Error: APK specifies a version code that has already been used..
I see that the latest version in Google Play store is 1.0.3601
In the release pipeline I see that the versionCode generated is 1.0.3603 and versionName is 1.0.3604
How can this be solved? What am I doing wrong?
As suggested by User Kingston Fortune - Stack Overflow, make sure to change versionCode and versionName in build.gradle file:
defaultConfig {
applicationId "com.my.packageId"
minSdkVersion 16
targetSdkVersion 27
versionCode 2 <-- increment this by 1
versionName "2.0" <-- this is the version that shows up in playstore,
remember that the versioning scheme goes as follows.
first digit = major breaking changes version
second digit = minor changes version
third digit = minor patches and bug fixes.
e.g versionName "2.0.1"
}
References: Upload failed You need to use a different version code for your APK because you already have one with version code 2 , Problem with build version when publishing APK to Play Store , https://github.com/bitrise-steplib/steps-google-play-deploy/issues/31 and https://developer.android.com/studio/publish/versioning#appversioning
so I'm trying to create a new release but I keep getting this error:
"You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1."
Someone said to add android:versionCode="2" in android manifest, but I still get the same error. My previous release did not have a version code. I'm wondering if perhaps it's an issue with the version code increment since I don't really know what the versionCode defaults to when it is not specified.
Please help. Thank you!
You have to set the versionCode and optionally the versioName.
defaultConfig {
...
versionCode 2
versionName "1.1"
}
Note versionCode is a number.
Check this link for more details: https://developer.android.com/studio/publish/versioning#appversioning
I have app on git with package for example com.foo.
Now I want to create clone of this app with different name.
In order to do it I fork my app and change the name. But this app has the same package.
And I can't install the second app because they have same package name.
What would be the best way to support two apps with same functions but different names?
Create different productFlavors for another app in same code
productFlavors {
VersionFirst {
applicationId "packagename"
versionName "1.0"
}
VersionSecond {
applicationId "packagename"
versionName "1.0"
}
}
generate different build using build varient
If two applications have the same package name, only one of them will be installed. If they share the same signature, installing the second package will overwrite the first assuming it doesn't downgrade the version. If they have different signatures, you'll get an error saying that you can't install the second package.
Read this :https://developer.android.com/guide/topics/manifest/manifest-element.html
We always have to increment versionCode by some arbitary number to publish it to google play.
Is there limit to that value and what will happen if it is reached?
defaultConfig {
applicationId "my.app"
minSdkVersion 15
targetSdkVersion 22
versionCode 65
versionName "1.05"
setProperty("archivesBaseName", "myapp-$versionCode")
}
Update 08/11/2016 (UTC):
The docs has been updated. Not the old MAX_INT value nor the 2000000000.
Warning: The greatest value Google Play allows for versionCode is 2100000000.
Cross-post for visibility here.
It seems there was a recent change in Google, making the maximum versionCode up to 2000000000 only.
Reference post: Google Play Developer Console error: The version code of your APK is high and you risk not being able to update your APK
PS: For those who are planning to provide reference to the official documentation where the mentioned max value is 2147483647, please read the answer first in the post I referenced. It mentions that as of current date (08/10/2016), its still not updated.
According to android documentation and the gradle DSL documentation:
android:versionCode — An integer value that represents the version of the application code, relative to other versions.
Checking the java doc, by default, the int data type is a 32-bit signed two's complement integer, which has a minimum value of -2^31 and a maximum value of (2^31)-1.
Then the maximum value is 2^31-1.
Starting at Android Pie (9), the version code will be a long (source). The max value of a long is 9,223,372,036,854,775,807 so you shouldn't run into any issues regarding length here.
Do note that it's still an int in older android versions, so long is only relevant to you when your minSdkVersion is 28 or higher.
The other responses are technically true but you should note that Google Play Store only accepts version codes up to 2100000000.
I went through the docs did not see anywhere mentioning on this,
If i release my app for alpha testing or a beta release with version Code 1, name 1.0 does this affect the production release which needs to be Code 1, Name 1.0.
Does the version system get carried over or will production release will have its own version flow.
Thank you.
When you upload an apk, you must use unique VersionCode (integer value) and show to the user the VersionName (string value). The PlayStore will not allow you to upload apk with already used VersionCode