我正在尝试让 Phonegap 在 Ubuntu 12.04 上工作。到目前为止,我已经使用本指南成功(很好)安装了它:http://perrymitchell.net/article/install_phonegap_ubuntu_12.04 http://perrymitchell.net/article/install_phonegap_ubuntu_12.04
我还添加了 android sdk 和 PATH 变量。
“phonegap create”命令成功,但是当运行“phonegap run android”或“phonegap build android”时,会发生以下情况:
rok@localhost:~/myapp$ phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the remote environment
/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/common/config/global.js:45
fs.exists(filepath, function(exists) {
^
TypeError: Object #<Object> has no method 'exists'
at Object.load (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/common/config/global.js:45:8)
at PhoneGapBuild.<anonymous> (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/login.js:60:19)
at PhoneGapBuild.login (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/login.js:47:13)
at PhoneGapBuild.<anonymous> (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/build.js:60:10)
at PhoneGapBuild.build (/usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/lib/phonegap-build/build.js:40:13)
at RemoteBuildCommand.execute (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.build.js:74:19)
at RemoteBuildCommand.run (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.build.js:54:10)
at Object.build (/usr/local/lib/node_modules/phonegap/lib/phonegap/util/command.js:28:25)
at RemoteRunCommand.execute (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.run.js:71:26)
at RemoteRunCommand.run (/usr/local/lib/node_modules/phonegap/lib/phonegap/remote.run.js:54:10)
尝试运行它也没有成功:
rok@localhost:~/myapp$ phonegap local plugin add org.apache.cordova.core.console
[phonegap] adding the plugin: org.apache.cordova.core.console
[error] Error fetching plugin: Error: connect ECONNREFUSED
我究竟做错了什么
为了回答我自己的问题,在使用phonegap成功运行hello world应用程序之前,还需要完成两件事(不仅在Ubuntu 12.04上,而且我假设在任何平台上):
- 从 CLI 运行“android”命令并下载至少一个版本的 SDK
- 运行“android avd”命令并根据之前下载的 SDK 版本创建至少一个虚拟设备。
然后我就可以在 PhoneGap 网站上描述的小 hello 应用程序上运行“phonegap run android”。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)