如何升级科尔多瓦2.9.0在Android开发工具3.6?开发工具、科尔、多瓦、Android

2023-09-06 00:44:29 作者:你的眼里有星星

最近我被送到一个警告,由谷歌来升级我的应用程序使用,因为在previous版本中可能存在的安全漏洞,科尔多瓦3.5.1。我看到科尔多瓦的最新版本是3.6,所以我可能也升级到了。

我使用的是Android开发工具,基于Eclipse,建立我的Andr​​oid应用程序。所有我想要做的就是3.6的版本替换科尔多瓦2.9.0,然后重新生成应用程序,并把它上传到了市场。

我通过这一切的东西在一年前去了,但我挣扎追溯我的步骤我如何设置它。 Eclipse的接口是什么,但直观且易于使用。这甚至没有明显的如何打开现有项目。此外,它似乎科尔多瓦已经改变这样的,它不是简单地替换现有的的.jar 文件的问题。事情已经显著改变,因为我是最后交易与此有关。

如何升级科尔多瓦到最新版本的在使用谷歌的Andr​​oid农业开发工具(ADT)的情况下?具体而言,我想使现有ADT项目中使用新的科尔多瓦版本。

解决方案

更新答案:

自从2.9.0

几个重要的事情发生了变化。其结果是,你的科尔多瓦2.9.0项目的结构不与科尔多瓦3+兼容。

其中最重要的变化是,在科尔多瓦3.0,所有的原料药是从框架到插件移动。这意味着对于任何科尔多瓦API的使用,在3.0+项目,你将需要的插件添加到您的项目之前,这些API将可用。例如,在科尔多瓦2.9.0,科尔多瓦摄像头API是内置在科尔多瓦的框架,这样你就可以调用的 navigator.camera.getPicture(successCB,errorCB,期权)不添加任何插件到您的项目。开始在科尔多瓦3.0,你需要添加科尔多瓦相机插件,以便做出相同的呼叫您的项目。

有没有办法升级,从2.9.0到3.6.0仅采用Android开发工具。还有升级的方法不止一种,但我建议您按照布局在升级年级的官方文档中的步骤。升级指南只列出了渐进的步骤,这可能会造成混淆,如果你还没有,因为2.9.0做过任何科尔多瓦发展,所以这里是一个2.9.0至3.6.0汇总的基础上从升级Android的指南定义的增量步长官方文档。

有几个步骤,你将需要完成。

在一些情况下备份原始项目,就会出差错,你需要重新开始。如果你有科尔多瓦2.9.0安装,创建一个新的空白项目。您可以使用此作为基准来寻找定制的资产你已经通过使用一个diff工具添加。这可能是在第4步的帮助。

通过执行官方文档。

创建一个新的科尔多瓦的项目,用项目的包名和应用程序标题:

科尔多瓦创造projectPath projectPackage PROJECTNAME

更改到项目目录,并添加Android平台:

CD projectPath 科尔多瓦平台添加的android

从原来的项目将您的自定义项目资产到您的新项目。 一个。资产/ WWW排除config.xml中,cordova_plugins.js,cordova_plugins.json和cordova.js的内容。 湾的RE /绘制* 内容 C。这取决于你的项目,有可能是因为你将需要复制其他本地资产 - 但要小心覆盖文件 - 在某些情况下,你可能需要您的自定义内容,而不是复制覆盖它与现有的文件中的新项目。如果有疑问,比较文件并排侧。照片

安装所需的任何核心插件。你需要确定哪些科尔多瓦的API您的项目用途,然后标识为他们提供的插件。在大多数情况下,你应该能够开始参照的在工具条中,看看哪些科尔多瓦2.9.0对象提供所使用的API,然后在的科尔多瓦3.6.0插件的API列表。在某些情况下,名称已被更改,但在大多数情况下它应该很容易找到你需要的插件。例如,要安装摄像头插件,你会(不是在平台/安卓android的根,但在顶级lvel根)运行在你的项目的根目录下面的命令:

科尔多瓦插件添加org.apache.cordova.camera

处理自定义插件。如果你正在使用的自定义插件,您将需要更新到新版本,它与科尔多瓦3.6.0兼容。

更​​新项目占API的变化。某些API已经改变了不少,因为2.9.0 - 这可能需要你做出code更改

原来的答复: 这里是介绍如何从2.9.0到最新版本升级的官方文档。

不幸的是,目录结构自2.9.0改变几次,所以你必须围绕手动移动一些文件。

MotoXoom WiFi MZ606界面图图片57素材 IT168平板电脑图片大全

如果你有以下的记录的步骤请评论,我会尽量协助。麻烦

Recently I was sent a warning by Google to upgrade my app to use Cordova 3.5.1 because of a possible security vulnerability in previous versions. I see the latest version of Cordova is 3.6, so I might as well upgrade to that.

I am using Android Developer Tools, based on Eclipse, to build my Android app. All I want to do is replace Cordova 2.9.0 with version 3.6, then rebuild the app and upload it to the market.

I went through all this stuff a year ago, but I'm struggling to retrace my steps on how I set it up. The Eclipse interface is anything but intuitive and easy to use. It's not even obvious how to open an existing project. Also, it seems Cordova has changed such that it's not simply a matter of replacing the existing .jar file. Things have changed significantly since I was last dealing with this.

How do I upgrade Cordova to the latest version in the context of using Google's Android Develpment Tools (ADT)? Specifically, I want to make an existing ADT project use the new Cordova version.

解决方案

Updated answer:

Several important things have changed since 2.9.0. As a result, the structure of your Cordova 2.9.0 project is not compatible with Cordova 3+.

One of the most important changes is that in Cordova 3.0, all of the APIs were moved from the framework into plugins. This means that for any Cordova APIs you use, in a 3.0+ project, you will need to add plugins to your project before those APIs will be available. For example, in Cordova 2.9.0, the Cordova Camera APIs were built in to the Cordova framework, so you would be able to call navigator.camera.getPicture(successCB, errorCB, options) without adding any plugins to your project. Starting in Cordova 3.0, you would need to add the Cordova Camera plugin to your project in order to make that same call.

There is no way to upgrade from 2.9.0 to 3.6.0 only using Android Developer Tools. There is more than one way to upgrade, but I recommend that you follow the steps laid out in the upgrade grade in the official documentation. The upgrade guide only lists incremental steps, which might be confusing if you have not done any Cordova development since 2.9.0, so here's a 2.9.0 to 3.6.0 summary based on the incremental steps defined in the "Upgrading Android" guide from the official documentation.

There are several steps that you will need to complete.

Backup your original project in case something goes awry and you need to start over. If you have cordova 2.9.0 installed, create a new blank project. You can use this as a baseline to find what custom assets you've added by using a diff tool. This might be helpful in step 4.

Install cordova 3.6.0 by following the instructions in the official documentation.

Create a new cordova project, using your project's package name and application title:

cordova create projectPath projectPackage projectName

Change to the project directory and add the Android platform:

cd projectPath cordova platform add android

Copy your custom project assets from your original project into your new project. a. the contents of assets/www excluding config.xml, cordova_plugins.js, cordova_plugins.json and cordova.js. b. the contents of res/drawable* c. depending on your project, there may be other native assets that you will need to copy - but be careful about overwriting files - in some cases you might need to copy your custom contents into the existing file in your new project instead of overwriting it. When in doubt, compare the files side-by-side.

Install any "core" plugins that you need. You'll need to identify which Cordova APIs your projects uses, then identify the plugin that provides them. In most cases, you should be able to start by referring to the Cordova 2.9.0 API Reference in the sidebar to see which Cordova 2.9.0 object provided the API you use, then match it up with the corresponding plugin in the Cordova 3.6.0 Plugin APIs list. In some cases names have been changed but for the most part it should be straightforward to find the plugin you need. For example, to install the camera plugin, you would run the following command in the root of your project (NOT in the android root at platforms/android, but in the top-lvel root):

cordova plugin add org.apache.cordova.camera

Deal with custom plugins. If you are using any custom plugins, you will need to update to a newer version that is compatible with Cordova 3.6.0.

Update your project to account for API changes. Some of the APIs have changed quite a bit since 2.9.0 - this might require you to make code changes.

Original answer: Here is the official documentation that describes how to upgrade from 2.9.0 to the latest version.

Unfortunately, the directory structure has changed a couple times since 2.9.0, so you'll have to manually move some files around.

If you have trouble following the documented steps please comment and I will try to assist.