versionCode vs versionName in Android Apps

versionCode 1
versionName "0.1"

versionName

is a string which is visible to the user in the settings menu under App Info

versionCode

is an integer. It is used to compare APK updates against each other to make sure apps aren’t downgraded.

val packageInfo: PackageInfo = this.packageManager.getPackageInfo(this.packageName, 0)
Log.d(packageInfo.versionName)
Log.d(packageInfo.versionCode)

https://developer.android.com/studio/publish/versioning