Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

java - Maximum Length of Android versionName / versionCode (Manifest)

I am trying to find out the maximum length of both the android:versionName and android:versionCode attributes of the android manifest file?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.xxxx.xxxx"
          android:versionCode="185"           <--- THIS ATTRIBUTE
          android:versionName="1.0.185">      <--- AND THIS ATTRIBUTE

Is there a maximum value or will it pretty much allow anything if there is no maximum are there certain rules in place?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Based on android documentation:

android:versionCode — An integer value that represents the version of the application code, relative to other versions.

Edit - Android documentation explicitly states -

Warning: The greatest possible value for android:versionCode is MAXINT (2147483647). However, if you upload an app with this value, your app can't ever be updated.

Based on oracle documentation:

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. In Java SE 8 and later, you can use the int data type to represent an unsigned 32-bit integer, which has a minimum value of 0 and a maximum value of (2^32)-1.

android:versionName — A string value that represents the release version of the application code, as it should be shown to users.

Regarding String max length, this SO question may help you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...