PhoneGap的如何使Android版本 [英] Phonegap How to make android build

查看:133
本文介绍了PhoneGap的如何使Android版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创造了IOS构建成功。现在我努力使构建机器人。
我已经加入Android平台,并在eclise(ADT)进口这一点。我要让配置为Android,因为我是新来的移动应用程序。我无法找到Android的建设任何教程很好的参考。我看着入门的PhoneGap的教程,但它并没有太多帮助的

I have created a build in ios successfully. Now i am trying to make build in android. I have added android platform and imported this in eclise(ADT). I want to make configuration for android, as i am new to mobile application. I am unable to find any good reference for building android tutorial. I looked into getting started tutorial of phonegap but it was not much helpful

推荐答案

我假设你正在使用科尔多瓦3.0和CLI

I assume you're using Cordova 3.0 and CLI

请按以下(你可能已经做了一些步骤,完整性,我列出了他们在这里反正)

Proceed as following (some steps you might have already done, for completeness, I list them here anyway)


  1. 开放的的Eclipse ADT - >窗口 - > Android的SDK管理器的,并确保你至少有对Android SDK工具,Android的SDK平台工具,并至少在API安装。

  1. Open Eclipse ADT -> Window -> Android SDK Manager and make sure you have at least the 'Android SDK Tools', 'Android SDK Platform-tools' and at least on API installed.

在Android SDK工具和Android的SDK平台工具添加到您的路径。

Add the 'android sdk tools' and 'android sdk platform-tools' to your path.

在您的应用程序科尔多瓦(例如/对myApp)文件夹,执行 $科尔多瓦平台添加的android

In your cordova app (e.g. /myApp) folder, execute $cordova platform add android

林假设你把所有的JS code正确捆绑在/对myApp / www文件夹,因为你已经有一个工作的ios建设。否则,这样做。

Im assuming you have all your jscode correctly bundled in the /myApp/www folder, as you already have a working ios build. Otherwise, do so.

插入您的Andr​​oid设备或创建并启动一个新的AVD(在Eclipse:窗口 - >Android虚拟设备管理器的)。

Plug in your Android Device or create and start a new AVD (In Eclipse: Window -> 'Android Virtual device manager').

执行 $科尔多瓦prepare机器人

打开Eclipse,然后的文件 - >导入 - > Android的/现有code进入工作区的。在开导入Projects'-窗口中,选择你的/对myApp /平台/ Android作为根目录。根据您的工作空间,必须选择复制项目到工作区,但是您的工作空间就会好多了包括项目,因为这样可以节省你从每$科尔多瓦prepare声明

Open Eclipse and then File -> Import -> Android/Existing Code Into Workspace. In the opening 'Import Projects'-Window, select your /myApp/platforms/android as root directory. Depending on your workspace, you must select 'Copy projects into workspace', however your workspace would better already include the project, as this saves you from importing a new project after every $cordova prepare statement

在Eclipse中:运行 - >运行配置 - >目标的::取决于无论您使用的AVD或不输入设置

In Eclipse: Run -> Run Configurations -> Target:: Enter Your settings depending on wether you use AVD or not.

在右下:运行。您的应用程序将建成并运行。

On the bottom right: Run. Your app will be built and run.

注:


  • 如果您使用多张的平台(如Android和iOS),这种方式是比较preferable比user1306579的方式,在那里你复制/硬连接您的code直接在/对myApp /平台/安卓/文件夹,因为你必须为每一个洗车台做同样甚至更糟糕:如果您运行$科尔多瓦prepare(或含有本,为$科尔多瓦运行,$科尔多瓦建设,......任何命令),你会失去你的变化

  • 从不编辑Javascript成为code直接在您的 /对​​myApp /平台/(anyplatform)/网络/ 的文件夹即可。始终使用的 /对​​myApp / WWW / 的并运行 $科尔多瓦prepare 之后...

  • 第5步之后,你可以使用 $科尔多瓦仿真机器人(您AVD)或科尔多瓦运行的Andr​​oid (实设备),这将取代所有其他步骤。然而,如果有错误上来,发现的原因可能是更加困难的。

  • 如果您的问题是在如何configurate的Andr​​oid应用(平台合并,舱单配置,...)随意问一次:)

  • If you use mulitple platforms (e.g. android and ios), this way is more preferable than the way of user1306579, where you copy/hardlink your code directly in the /myApp/platforms/android/ folder, as you would have to do this for every platfrom equally and even worse: If you run $cordova prepare (or any command containg this, as $cordova run, $cordova build, ...) you would loose your changes.
  • Never edit JavaScript-Code directly in your /myApp/platforms/(anyplatform)/www/ folder. Always use /myApp/www/ and run $cordova prepare afterwards...
  • After step 5 you could use $cordova emulate android (for your avd) or cordova run android (real device), which would replace all other steps. However, if there are errors coming up, finding the reasons might be more difficult.
  • If your questions was over how to configurate the android app (platform merges, manifest configurations, ...) feel free to ask again :)

问候,miweiss

Regards, miweiss

这篇关于PhoneGap的如何使Android版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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