如何检查cordova/phonegap项目的cordova android版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26200127/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:06:44  来源:igfitidea点击:

How to check cordova android version of a cordova/phonegap project?

androidcordova

提问by Imon

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 -

本周我收到了来自 Google 的安全警报,提示我升级我的 Android 版本的cordova 应用程序。来自谷歌的电子邮件如下 -

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.

这是一个通知,表明您的 --apps ids-- 是基于包含安全漏洞的 Apache Cordova 版本构建的。这包括一个高严重性的跨应用程序脚本 (XAS) 漏洞。在某些情况下,易受攻击的应用程序可能会被远程利用来窃取敏感信息,例如用户登录凭据。

您应该尽快升级到 Apache Cordova 3.5.1 或更高版本。有关漏洞的更多信息以及升级 Apache Cordova 的指南,请参阅http://cordova.apache.org/announcements/2014/08/04/android-351.html

请注意,存在使用户面临被入侵风险的漏洞的应用程序可能被视为“危险产品”,并可能会从 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 cordovaon windows cmd. The question is how can I check the current platform (android in my case) version of my cordova app?

因此,我需要检查我的cordova 应用程序的当前版本。我可以通过npm update -g cordova在 Windows cmd 上使用来升级我的cordova 安装。问题是如何检查我的cordova 应用程序的当前平台(在我的情况下为android)版本?

回答by Imon

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

可以通过以下命令检查cordova应用程序的当前平台版本

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.

您可以用您选择的任何平台(如“ios”或其他平台)替换 android。

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

这只适用于安卓平台。我没有查过。可以尝试替换代码段中的android尝试其他平台。

回答by frank

Run

cordova -v 

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

查看当前运行的版本。运行 npm info 命令

npm info cordova

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

包含当前版本和其他可用版本号的更长列表

回答by husain shah

just type cordova platform ls

只需输入 cordova platform ls

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

这将列出所有已安装的平台及其版本并可供安装以及 :)

回答by aWebDeveloper

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

还要知道cordodva cli的版本试试

cordova -v 

回答by Adam

The file platforms/platforms.jsonlists all of the platform versions.

该文件platforms/platforms.json列出了所有平台版本。

回答by RonaldPK

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

Cordova 的最新版本在 www/cordova.js 中有版本号。

回答by Atif Hussain

After upgrading the Application. I observed different Cordova versions.

升级应用程序后。我观察到不同的 Cordova 版本。

  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.
  1. Apache Cordova Cli 版本是 6.0.0。
  2. Cordova Android 版本是 5.1.0。
  3. Cordova IOS 版本为 4.1.1。
  4. Docs 版本是 6.0.0,显示在 Cordova Docs 网站上。

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

现在我很困惑,在哪个版本的基础上,Google Dev Console 发出警告?

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.

请尽快将您的应用迁移到 Apache Cordova v.4.1.1 或更高版本,并增加升级后的 APK 的版本号。从 2016 年 5 月 9 日起,Google Play 将禁止发布任何使用 Apache Cordova 4.1.1 之前版本的新应用程序或更新。

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.

这些漏洞已在 Apache Cordova 4.1.1 中得到解决。如果您使用捆绑 Apache Cordova 的 3rd 方库,则需要将其升级到捆绑 Apache Cordova 4.1.1 或更高版本的版本。

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.
  1. Apache Cordova Cli 版本为 5.4.1。
  2. Cordova Android 版本是 4.1.1。
  3. Cordova IOS 版本为 3.9.1。
  4. Docs 版本是 5.4.1,显示在 Cordova Docs 网站上。

回答by Lakshay Sharma

For getting all the info about the cordova package use this command:

要获取有关 cordova 包的所有信息,请使用以下命令:

npm info cordova