Software Archive
Read-only legacy content
17061 Discussions

App Version Error with cordova plugin app version

Anjali_P_
Beginner
461 Views

Hii..

I have updated the intel xdk to version 3987.

I am not able to the get app version.

I have used the following plugin to get the app version :        https://www.npmjs.com/package/cordova-plugin-appversion

Earlier with old version of intel xdk 3400 series (I don't remember the exact version), with the following command i am able to get the app version:

AppVersion.version

But after updating to intel xdk 3987,I am getting following error as : Cannot read property 'version' of undefined.

0 Kudos
3 Replies
PaulF_IntelCorp
Employee
461 Views

The version of the XDK has no bearing on this problem. This has to do with which version of the plugin you are using and which version of Cordova CLI you are building with. Also, you do not describe how you are testing this. Is this test for the existence of AppVersion.version being done in App Preview or the Simulate tab? Or is it being done in a build app? How did you build the app?

Please also review the plugin's documentation, it's possible the author changed the API since you last used it, and that you are not using the same version. Do you know which version you previously used? Do you know which version you are using now?

0 Kudos
Anjali_P_
Beginner
461 Views

Hii..

I built the apk through intel xdk only.

I set the app version as(3.1.0) in the project tab under build settings.

I have build the app using cordova CLI.

The version of the cordova CLI is 6.5.0

I am testing this app in  the phone after building the apk file.

Currently I am using API level 25.

 

 

 

 

0 Kudos
PaulF_IntelCorp
Employee
461 Views

Set the min API level to 16 or 19 (Android 4.1 or Android 4.4). Set the target API level to 19 or 21 (Android 4.4 or Android 5.0). Do not set either API level to 25 (Android 7.1). See this table for more details > https://source.android.com/source/build-numbers < regarding the API levels.

The target API level DOES NOT mean this is the highest version of Android your app will run on, it means this is the version your software has been tested against and is compatible with, which, in the case of a Cordova app, refers mostly to the plugins you use (because that is where the Android version-dependent code is located). That plugin is quite old, and I am sure it has never been tested against API level 25, so a target API of 19 or 21 is your safest bet. Setting the target API to something like Android 4.4 or 5.0 will not prevent your app from being installed on an Android 7 device, it means special "compatibility libraries" will be used to insure that it runs on Android 6 and 7, etc.

Try also building it with PhoneGap Build using these changes as a comparison point, to see if you get different results.

Also, see this article > https://software.intel.com/en-us/xdk/docs/using-remote-chrome-devtools-to-debug-android-cordova-apps < for details on how to build a debuggable APK so you can then use remote CDT to debug your app directly over USB.

0 Kudos
Reply