80

I have received a Security Alert from Google this week that tells me to upgrade my android version of cordova app. The email from google is as below -

This is a notification that your --apps ids--, is built on a version of Apache Cordova that contains security vulnerabilities. This includes a high severity cross-application scripting (XAS) vulnerability. Under certain circumstances, vulnerable apps could be remotely exploited to steal sensitive information, such as user login credentials.

You should upgrade to Apache Cordova 3.5.1 or higher as soon as possible. For more information about the vulnerabilities, and for guidance on upgrading Apache Cordova, please see http://cordova.apache.org/announcements/2014/08/04/android-351.html.

Please note, applications with vulnerabilities that expose users to risk of compromise may be considered “dangerous products” and subject to removal from Google Play.

So, I needed to check the current version of my cordova apps. I can upgrade my cordova installation by using npm update -g cordova on windows cmd. The question is how can I check the current platform (android in my case) version of my cordova app?

Community
  • 1
  • 1
Imon
  • 3,905
  • 4
  • 25
  • 25
  • 1
    the version the above "Security Alert" refers to is the version of Cordova used in your app, which may not be the same as the Cordova version installed on your system - http://stackoverflow.com/questions/26200127/how-to-check-cordova-android-version-of-a-cordova-phonegap-project#comment41087726_26200138 and http://devgirl.org/2014/11/07/cordovaphonegap-version-confusion/– Sandra – Sandra Feb 15 '16 at 10:58
  • [Cordova Command-line-interface (CLI) Reference](https://cordova.apache.org/docs/en/latest/reference/cordova-cli/index.html#cordova-create-command) – Anoop M Maddasseri May 03 '17 at 04:29

8 Answers8

146

The current platform version of a cordova app can be checked by the following command

cordova platform version android

And can be upgraded using the command

cordova platform update android

You can replace android by any of your platform choice like "ios" or some else.

This only applies to android platform. I have not checked. You can try replacing android in the code segments to try for other platforms.

Imon
  • 3,905
  • 4
  • 25
  • 25
  • 5
    I strongly disagree, your first command simply shows `Installed platforms: wp8` and there is no version info whatsoever. The command only tells me what I already know, that I have the wp8 platform. Any suggestions? – andreszs Feb 05 '15 at 18:46
  • Hello Andrew. Do you want to check your android platform version? Have you installed android platform? Please check the platform folder in your application directory. Is there any folder named android? – Imon Feb 09 '15 at 06:19
  • 1
    My mistake, this only applies to Android platform, not WP8. If you edit your answer I can correct my vote. – andreszs Feb 09 '15 at 19:26
45

Run

cordova -v 

to see the currently running version. Run the npm info command

npm info cordova

for a longer listing that includes the current version along with other available version numbers

frank
  • 3,180
  • 3
  • 16
  • 18
  • 8
    It is possible that the version of a app is different from Cordova itself. – Duncan McGregor Oct 05 '14 at 07:19
  • I am not able to understand your query. Can you explain please? I am assuming that you have your app on the google play store. Then it is quite possible that the App and the cordova version on your machine will not match, if you have updated your local machine cordova. – frank Oct 05 '14 at 08:06
  • 2
    If you install Cordova 3.5 and run `cordova platform add ios` then the version of the iOS project will be 3.5, even after you run `npm install -g cordova` to get 3.6. So listing the version of Cordova won't necessarily tell you the version your app is using. – Duncan McGregor Oct 05 '14 at 11:01
  • Why do I see 3.7.0 with the `npm info cordova` command, but that version is not listed when I use `npm view cordova versions`? I wan't to install version 3.7.0 and I can't!! Thanks... – andreszs Feb 05 '15 at 18:44
  • The question was about a given cordova project, not the local machine command line tools for cordova version – OlivierM May 14 '15 at 21:43
34

just type cordova platform ls

This will list all the platforms installed along with its version and available for installation plus :)

Khalid Hussain
  • 345
  • 4
  • 16
husain shah
  • 371
  • 5
  • 11
16

Try

cordova platform version

It will give you the following output

Installed platforms: android 3.5.1, ios 3.5.0
Available platforms: amazon-fireos, blackberry10, browser, firefoxos

Also to know the version of cordodva cli try

cordova -v 
aWebDeveloper
  • 36,687
  • 39
  • 170
  • 242
4

The file platforms/platforms.json lists all of the platform versions.

Adam
  • 410
  • 5
  • 13
2

Recent versions of Cordova have the version number in www/cordova.js.

RonaldPK
  • 760
  • 4
  • 18
1

After upgrading the Application. I observed different Cordova versions.

  1. Apache Cordova Cli version which is 6.0.0.
  2. Cordova Android version which is 5.1.0.
  3. Cordova IOS version which is 4.1.1.
  4. Docs version is which is 6.0.0, shown on the Cordova Docs website.

Now i am confused, On which version basis, Google Dev Console is giving warning?

Please migrate your app(s) to Apache Cordova v.4.1.1 or higher as soon as possible and increment the version number of the upgraded APK. Beginning May 9, 2016, Google Play will block publishing of any new apps or updates that use pre-4.1.1 versions of Apache Cordova.

The vulnerabilities were addressed in Apache Cordova 4.1.1. If you’re using a 3rd party library that bundles Apache Cordova, you’ll need to upgrade it to a version that bundles Apache Cordova 4.1.1 or later.

And before upgrading. Our Application versions were these.

  1. Apache Cordova Cli version which is 5.4.1.
  2. Cordova Android version which is 4.1.1.
  3. Cordova IOS version which is 3.9.1.
  4. Docs version is which is 5.4.1, shown on the Cordova Docs website.
Atif Hussain
  • 880
  • 12
  • 19
  • Google shows warning based on Cordova Android version. You have to wait sometime after publishing the upgrade to disappear the warning. – Imon May 05 '16 at 09:27
0

for checking the cordova version

cordova-res -v
Ritunjay kumar
  • 261
  • 3
  • 6