cordova/phonegap 不制作 android 目录 [英] cordova/phonegap does not make android directory

查看:30
本文介绍了cordova/phonegap 不制作 android 目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ant、java、node.js、phonegap 和我的 adobe 帐户都设置正确.入门指南 说我应该能够输入:

ant, java, node.js, phonegap, and my adobe account are all setup properly. The getting started guide says I should be able to type:

cordova create hello com.example.hello "HelloWorld"

创建一个phonegap项目.这不起作用,但遵循 这些 说明和做:

to create a phonegap project. This does not work but following these instructions and doing:

phonegap build android

最终确实给我一个 .apk 文件.但是入门指南告诉我打开eclipse并导航到我的项目目录,然后将子目录设置为/android.但是当您执行 phonegap build android 时不会创建/android,所以我无事可做.

does eventually get me a .apk file. But the getting started guide tells me to open eclipse and navigate to the directory of my project and then set the subdirectory as /android. but /android does not get created when you do phonegap build android so I have nothing to work with.

我如何获得 phonegap 来创建 android 目录?我正在尝试完成入门指南,而不是走捷径.

How do I get phonegap to create the android directory? I am trying to finish the getting started guide instead of taking shortcuts.

推荐答案

看起来您使用的是 PhoneGap 3.0 并且对于此版本,不需要 eclipse(仅当您想将其用于编码时 - 与 PhoneGap 1.0 相比)-2.x 其中 eclipse 用于编译应用程序,对于最新版本不再需要).

It does seem like you are using PhoneGap 3.0 and for this version, eclipse is not required (only if you want to use it for coding - compared to PhoneGap 1.0-2.x where eclipse was used to compiled the app, for the latest version it is no longer a requirement).

  1. 首先,您应该使用 phonegap 命令而不是 cordova 命令:phonegap create hello com.example.hello "HelloWorld"

  1. To begin, you should use the phonegap command instead of the cordova command: phonegap create hello com.example.hello "HelloWorld"

然后导航到/HelloWorld/文件夹

您至少应该看到这两个关键文件夹 /www/platforms./www 是你放置 HTML 文件和代码的地方,当你使用以下命令编译应用程序时会生成 /platforms/android: phonegap build android.

You should see atleast these two key folders /www and /platforms. Inside /www is where you place your HTML files and codes, and /platforms/android gets generated when you compile the app with the following command: phonegap build android.

注意:避免对 /platforms 中的文件进行任何直接更改,配置和清单文件除外.其他文件在您运行 build 命令时动态生成.所有编码都应在 /www 中进行.

Note: Avoid making any direct changes to files inside /platforms except for config and manifest files. The other files are dynamically generated when you run the build command. All coding should take place within /www.

还有一件事,使用 3.0.0 入门指南.

One more thing, use the 3.0.0 Getting Started guide.

---- 2014 年 2 月更新----

随着 Cordova 3.3.0 的发布,PhoneGap 团队似乎正在努力解决命名混乱问题.文档已更新以推荐人们使用 cordova 命令代替.不要再使用 phonegap 命令.

With the release of Cordova 3.3.0, it seems the PhoneGap team is trying to address the naming confusion. The documentations have been updated to recommend people using the cordova command instead. Do not use the phonegap command anymore.

这是保证无故障设置的全新安装指南:

Here is a fresh installation guide for a guaranteed trouble free set up:

  1. 安装 Cordova(从现在开始忘记名称 PhoneGap).对于 PC:

  1. Install Cordova (forget the name PhoneGap from now on). For PC:

C:> npm install -g cordova

在命令提示符下,使用以下命令导航到要创建项目的文件夹:

From command prompt, navigate to the folder you want to create your project using:

cordova create hello com.example.hello HelloWorld
cd HelloWorld

定义你想要支持的操作系统,我们将在这个例子中使用Android:

Define the OS you want to suppport, we'll go with Android for this example:

cordova platform add android

安装插件(如果需要).例如我们想要以下内容:

Install plugins (If needed). For example we want the following:


cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.camera
cordova plugin add org.apache.cordova.media-capture
cordova plugin add org.apache.cordova.media

cordova build android

生成应用程序或者直接将应用安装到您连接的设备上:

or to directly install the app to your connected device:

cordova run android

这是 PhoneGapCordova 3.3.0 文档的链接http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface

Here is a link to the PhoneGapCordova 3.3.0 Documentation http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface

这篇关于cordova/phonegap 不制作 android 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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