i'm using the plugin cordova-plugin-app-version to get the versionCode and VersionNumber in my Hybrid Application on Android.
But there seems to be a problem with the versionCode. My AndroidManifest.xml looks like:
<manifest android:versionCode="200420151420" android:versionName="0.0.1"
But my Android Tablet the versionCode displayed is a strange number like -1443311503
Does somebody have the same problem? Where does this come from? In my opinion it should be the timestamp from android:versionCode="200420151420" .
regards
Unfortunately 200420151420 is too big. The highest value you can use is 2147483647
android:versionCode — An integer value that represents the version of the application code, relative to other versions.
Reference:
http://developer.android.com/tools/publishing/versioning.html
int: 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
Reference:
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
Related
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'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.
I'm trying to integrate Twitter Login into my app using their Fabric sdk.
My app's requirements for minSDKVersion, targetSDKVersion and compileSDKVersion is 17. I've gone through the wizard that the Android Studio plugin provides and when I build the project, I get the following error...
Error:(107, 56) String types not allowed (at 'android:importantForAccessibility' with value 'noHideDescendants').
I see that noHideDescendants is a valid value for importantForAccessibility in Android's documentation
The error comes from intermediate build files of Twitter SDK for a style named tw__CompactAttributionLine in their values.xml.
Anybody knows a way of fixing this?
public static final int IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
Added in API level 19
The view is not important for accessibility, nor are any of its descendant views.
Constant Value: 4 (0x00000004)
ref : http://developer.android.com/reference/android/view/View.html
I am trying to upload v 1.1 of my application.
I guess I don't have to define a new application but when I try to upload a new APK I get an error stating that v1 is already exist.
I don't see how to change v1.0 to v1.1.
Can someone refer me to a proper documentation.
Thanks,
Simon
To increase the version of your android app you need to change the versioncode and versionname in your mainfest.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.package.name"
android:versionCode="2"
android:versionName="1.1">
The versioncode can only be an integer, just increase it by one every time you upload a new version. The versionname can be a string, here you define the version displayed in the Google Play Store.
Additional information:
http://developer.android.com/tools/publishing/versioning.html
apk upload failed to the google play market.
I am trying to upload the upgraded version of my app to the google play but I am keep getting the message -
Upload failed
You need to use a different version code for your APK because you already have one with version code 1.
Your APK needs to have the package name com.corntail.project.
There is still something that is looking for com.corntail.project and it is not being found.
UPDATE:
In my AndroidManifest.xml, the relevant code is -
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.corntail.main"
android:versionCode="1"
android:versionName="1.0" >
If you're using Android Studio or building with gradle, edit your gradle script (build.gradle) to change your package name and version. These values overwrite your AndroidManifest.xml file.
For example:
defaultConfig {
applicationId "com.xyz.abc"
minSdkVersion 16
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
You need to change your android:versionCode="1" to 2 on the AndroidManifest...
Things you have to keep in mind when updating your application on Google Play :
Change Version code +1 depending on the old value - if it's 1 , you have to change it to a bigger number.
Change your App Version Name to something bigger / different if it's string - if your old version is 1.0 - it should be 1.1 / 1.0.1 or whatever you like (it's always a better option t have some version name strategy, if it will contains the date update addded or the revision it depends on you).
And if you want to be able to update your app, don't change project package name! That's how android system knows that this application is different than that one. If you change your package name, it's now acting like a new app and you won't be able to update it from Google Play Store! To change your package name to com.corntail.project first you need to change it in manifest and after that in your project's main package and you need to keep track of your activities, if you declared them with package name too. For example :
if your MainActiivty was declared in manifest like :
com.corntail.main.MainActivity
you need to change it now to be like :
com.corntail.project.MainActivity.
You need to use a different version code for your APK because you
already have one with version code 1.
You must change your version code in your androidmanifest.xml
Every time you update your app change this variable in you XML file:
android:versionCode="1"
You are getting 2 errors.
The Version Code: you always need to set a higher number in the versionCode and always use an integer number. (don't use 1.1)
android:versionCode="1"
The package name: it has to match the same string that you used in the latest version that you upload. So instead of package="com.corntail.main" you should use:
package="com.corntail.project"
After modify the AndroidManifest.xml save it and then search in the folder src the package called "com.corntail.main", right click, Refactor > Rename, and the new name should match what you put in package (in this example you should call it: 'com.corntail.project') and you are done!
Good luck!
You have change version code in increasing order i.e. 1,2,3...so on as every time you uploaded. In every upload version code should have greater number than previous upload version code. You can change version code in APP Module Build.gradle file.
Image
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.xyz"
minSdkVersion 14
targetSdkVersion 24
versionCode 5
versionName "1.1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
If you build with gradlew, you should check the build.gradle file,
the applicationId will overwrite the package value in the AndroidManifest.xml
android {
defaultConfig {
applicationId "xxx.xxx.xxx"
}
}