1

Are there requirements for versionName in Android? Can it be an arbitrary string, like Ubuntu’s releases (Bionic Beaver etc.)

Jacob
  • 1,335
  • 1
  • 14
  • 28
  • Possible duplicate of [versionCode vs versionName in Android Manifest](https://stackoverflow.com/questions/9629125/versioncode-vs-versionname-in-android-manifest) – ADM Aug 13 '18 at 11:03

2 Answers2

2

There are no restrictions on choosing versionName. You can use "foo", "bar", "test-1", "release-2". Just string. This name is for showing user version, nothing else.

From Android Documentation

versionName

  • A string used as the version number shown to users. This setting can be specified as a raw string or as a reference to a string resource.
  • The value is a string so that you can describe the app version as a .. string, or as any other type of absolute or
    relative version identifier. The versionName has no purpose other
    than to be displayed to users.
Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212
0

You can use any string you want for version name. There's no rule to this.

PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
Toast.makeText(getActivity(), "Version " + packageInfo, Toast.LENGTH_LONG).show();

That will show your package name.

Mbuodile Obiosio
  • 1,463
  • 1
  • 15
  • 19