Eclipse和PhoneGap的/科尔多瓦开发3 [英] Developing with Eclipse and Phonegap/Cordova 3

查看:195
本文介绍了Eclipse和PhoneGap的/科尔多瓦开发3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎文件是有点薄,我向你保证,我试图找到这个网上,但我真的不明白怎样的发展过程应该与PhoneGap的和Eclipse的工作。

It seem the documentation is a bit thin and I assure you I have tried to find this online, but I really don't get how the development process is supposed to work with phonegap and eclipse.

我跟着的许多教程之一,使用的科尔多瓦命令行创建的Hello World示例。我加入了android平台和运行版本。在那之后,我加入了andoridy位作为Eclipse的一个项目相对于现有的来源,使用的子目录平台/ Android的目录指示。这让我建立了仿真器及所有工作非常出色。

I followed one of the many tutorials and created the Hello World example using the the cordova command line. I then added the android platform and ran the build. After that, I added the andoridy bit as a project in eclipse with respect to existing source as instructed using the subdirectory platforms/android directory. This allowed me to set up the emulator and all worked very well.

这个问题我现在已经是有发展过程。

The problem I now have is with the development process.

我明白我必须编辑顶层文件,而不是psented项目的资产目录中的日食,因为这些那些$ P $使用构建命令创建。这些顶层文件并不在我在Eclipse中创建的项目存在,因为它们是上述项目的根目录。

I understand that I have to edit the top level files, not the ones presented in the assets directory of the project in eclipse as these are created using the "build" command. These top level files don't exist in the project I've created in eclipse as they are above the root of the project.

所以,我的问题是...我可以使用Eclipse来开发这个项目的合理的方式?

So, my question is ... can I use eclipse to develop this project in a sensible way?

我在做什么,目前正在编辑的Andr​​oid WWW文件,然后抽起来的云构建,我将它们复制备份的树。这似乎是疯了。

What I'm doing at the moment is editing the android www files and then to pump it up to the cloud build, I'm copying them back up the tree. This seems insane.

有有在Eclipse提供真正的文件,这样我就可以开发它们,然后构建并部署到仿真器容易的一种方式?

Is there a way of having the real files available in eclipse so I can develop them and then build and deploy to an emulator easily?

PS是我的想象还是科尔多瓦建设需要年龄!

PS is it my imagination or does cordova build take ages!

解决方案

我添加了一个文件夹中的Andr​​oid项目,这是一个链接到根的WWW的位置内。这是在创建一个文件夹的高级选项。

I added a folder within the Android project which is a link to the location of the www in the root. This is under advanced options of creating a folder.

推荐答案

要做到这一点,你必须使用两个不同的Eclipse项目。 一个包含myProject的/ WWW文件夹用于开发(姑且称之为顶级项目),一个用于特定平台的项目(如机器人,因为你已经这样做)。

To do this, you must use two different eclipse projects. One containing the myProject/www folder for developing (let's call it 'top-level project') and one for your specific platform-project (e.g. android, as you already did).

在您的顶级项目,你写你的code和,如果你喜欢,你甚至可以调试到一定程度(功能不要求科尔多瓦)。然后保存并键入科尔多瓦prepare 在CLI。然后,您可以切换到你的Andr​​oid项目,打刷新(F5),然后运行模拟器/设备,查找漏洞,使Android系统清单的变化。如果你想改变code,再切换到您的顶级项目,做同样一遍又一遍。

In your top level project, you write your code and, if you feel like, you can even debug up to a certain degree (functions which do not require cordova). Then save and type cordova prepare in your CLI. You can then switch to your android project, hit refresh (F5) and run the emulator / device and look for bugs, and make Android-Manifest changes. If you want to change code, switch again to your top-level project and do the same over again.

这似乎有点不方便,对吧。不过,想想科尔多瓦不仅beeing开发在Android上,而且在iOS,Windows Phone的,黑莓,......要访问所有这些平台上,你反正要切换到多个IDE的。它使人们更方便的话,有顶级code在一个独立的项目。

This seems a bit unhandy, right. Nevertheless, think about cordova not beeing only for developing on android, but also on ios, windows phone, blackberry, ... To access all these platforms, you have to switch to multiple ide's anyway. It makes it a lot easier then, to have the top-level code in a independent project.

有些sidenodes:

Some sidenodes:

  1. 在做这个过程几次之后,你将失去不超过2或3秒科尔多瓦prepare 和交换项目。这是确定的,我想。

  1. After doing this process a few times, you will loose not more than 2 or 3 seconds to cordova prepare and switch projects. Which is ok, I think.

我自己做的不只是用不同的Eclipse项目,我甚至使用不同的Eclipse安装。这似乎更好地为我安排的,因为它保护我从混乱的顶部和低级别的文件。

I myself don't just use different eclipse projects, I even use different eclipse installations. This seemed better arranged for me, as it protects me from confusing top and low level files.

即使只开发Android版,你应该使用两个不同的项目,如科尔多瓦prepare'(或任何含有CLI命令prepare,作为构建,模拟和运行),将覆盖/删除你的文件。

Even if you develop only for android, you should use two different projects, as 'cordova prepare' (or any cli command containing prepare, as build, emulate and run) would overwrite/delete your files.

在我的安装,建设有CLI花费的时间是相同的,因为它在月食。这是有道理的,因为我使用的是相同的SDK两种。然而,在上述写入过程中,没有必要使用CLI-build命令

On my installation, building with CLI takes the same amount of time as it does in eclipse. Which makes sense, as I am using the same sdk for both. However, in the process written above, there is no need to use the cli-build command.

如果你只使用Android平台,但没有得到容易混淆的同名文件的一个项目,你可能在你的Andr​​oid项目链接对myApp / WWW文件夹。在这种情况下,你只会有一个项目的(信用为这个答案去stevemarvell自己,我只是添加此这里的完整性)

If you use just the android platform and don't get easily confused with same-named files in one project, you might link the myApp/www folder in your Android project. In this case, you will only have one project (Credit for this answer goes to stevemarvell himself, im just adding this here for completeness)

这篇关于Eclipse和PhoneGap的/科尔多瓦开发3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆