Nativescript version: 8.3; vue/ts.
I'm attempting to assign versioning to my Nativescript application, however it doesn't reflect accurately. Everything I've tried results in a versionName of 1.0.0 and versionCode of 1. This behavior occurs whether I am debugging or running a release build.
I've assigned the versionName and versionCode per the nativescript documentation and android documentation. My AndroidManifest.xml ([project_root]/App_Resources/Android/src/main/AndroidManifest.xml) looks 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 results in versionName of 1.0.0 and versionCode of 1:
let versionName = appversion.getVersionNameSync();
let versionCode = appversion.getVersionCodeSync();
I also get the same result when using (which is seemingly 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;
As well as:
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;
I've defined nsconfig.json as follows:
{
"appResourcesPath": "App_Resources"
}
I realize this is an optional step, though it is required in my case to work with nativescript-app-sync and a local nativescript-app-sync-server. Just mentioning for context.
CodePudding user response:
Did you try updating versionCode
in app.gradle as well?
Replace your manifest with this and try.
<manifest xmlns:android="schemas.android.com/apk/res/android"
xmlns:tools="schemas.android.com/tools"
package="PACKAGE"
android:versionCode="3"
android:versionName="1.0.2">