Nativescript version: 8.3; vue/ts.
I'm facing an issue with assigning versioning to my Nativescript application. Despite following the guidelines, the versionName remains 1.0.0 and versionCode stays at 1. This problem persists whether I am debugging or running a release build.
According to the nativescript documentation and android documentation, I have set the versionName and versionCode in my AndroidManifest.xml ([project_root]/App_Resources/Android/src/main/AndroidManifest.xml) as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="3"
android:versionName="1.0.2"
package="__PACKAGE__">
...
Using @nativescript/appversion returns versionName of 1.0.0 and versionCode of 1:
let versionName = appversion.getVersionNameSync();
let versionCode = appversion.getVersionCodeSync();
The same outcome is observed when using (which appears to be deprecated):
var packageManager = Application.android.context.getPackageManager();
let versionName = packageManager.getPackageInfo(
Application.android.context.getPackageName(), 0).versionName;
let versionCode = packageManager.getPackageInfo(
Application.android.context.getPackageName(), 0).versionCode;
And also with:
var packageManager = Utils.android.getApplicationContext().getPackageManager();
let versionName = packageManager.getPackageInfo(
Utils.android.getApplicationContext().getPackageName(), 0).versionName;
let versionCode = packageManager.getPackageInfo(
Utils.android.getApplicationContext().getPackageName(), 0).versionCode;
My nsconfig.json is defined as:
{
"appResourcesPath": "App_Resources"
}
Note: Though optional, I need this setup for compatibility with nativescript-app-sync and a local nativescript-app-sync-server. Just providing context.