简体   繁体   English

Phonegap安装/构建中的错误

[英]Error in installation/Building of Phonegap

I am new to phonegap. 我是Phonegap的新手。 I already have ADT in my PC. 我的PC中已经有ADT。

1)I installed NodeJs. 1)我安装了NodeJ。

2)I wrote on cmd 2)我在cmd上写过

npm install -g phonegap npm install -g phonegap

phonegap create my-app phonegap创建我的应用

cd my-app cd我的应用

phonegap run android phonegap运行android

[phonegap]detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
   [error] No platforms added to this project. Please use 'cordova platform add <platform>'.

Here I already set the correct PATH. 在这里,我已经设置了正确的路径。 But the same problem occurring. 但是发生同样的问题。 If anyone knows plz let me know. 如果有人知道,请告诉我。 Thnx 日Thnx

Still not working .. Can anybody knows this .. Plz .. Thanks in advance.. 仍然无法正常工作..有人知道吗.. Plz ..预先感谢..

I added these path for android: - 我为Android添加了以下路径:-

D:\\adt-bundle-windows-x86\\adt-bundle-windows-x86\\sdk\\platform-tools\\ d:\\ ADT-束窗口-X86 \\ ADT-束窗口86 \\ SDK \\平台工具\\

D:\\adt-bundle-windows-x86\\adt-bundle-windows-x86\\sdk\\tools\\ d:\\ ADT-束窗口-X86 \\ ADT-束窗口86 \\ SDK \\工具\\

and Java path is already set here.. So What's the problem here.. anyone can give the solution plz Java路径已经在这里设置了。所以这里出了什么问题。任何人都可以提供解决方案

EDIT: THIS ANSWER USES CORDOVA, NOT PHONEGAP 编辑:此答案使用的是CORDOVA,而不是PHONEGAP

You must tell cordova which platforms you are going to use (eg android) 您必须告诉cordova您将要使用哪些平台(例如android)

therefore, before executing command $cordova run android you must (once) execute cordova platform add android 因此,在执行命令$cordova run android您必须(一旦)执行cordova platform add android

For more details, see my answer here: Phonegap How to make android build 有关更多详细信息,请在此处查看我的答案: Phonegap如何进行android构建

Regards, miweiss 问候,miweiss

At last I got the solution 最后我得到了解决方案

Initially I wrote the command cordova platform add android , Then it was showing the error : 最初,我编写了命令cordova platform add android ,然后显示了错误:

No platforms added to this project. Please use 'cordova platform add <platform>'.

I did some changes: 我做了一些更改:

  • I change it to cordova -d platform add android 我将其更改为cordova -d platform add android

  • I reset all path, reset means again set my JAVA_HOME path and ANT_HOME path and then I gave the command cordova -d platform add android 我重置所有路径,重置意味着再次设置我的JAVA_HOME路径和ANT_HOME路径,然后我给命令cordova -d platform add android

  • then it was again showing error like There is no script engine for file extension .js . 然后它再次显示错误,例如There is no script engine for file extension .js Then just use the command in commmand prompt assoc .js=JSFILE and put the command on prompt cordova -d platform add android and its done, now it contains android folder within platforms. 然后只需在命令提示符assoc .js=JSFILE使用命令,然后将命令放在提示符cordova -d platform add android及其完成,现在它包含平台内的android文件夹。

Thank You All for help 谢谢大家的帮助

For Mac just add the cordova path : 对于Mac,只需添加cordova路径:

export PATH=$PATH:/usr/local/lib/node_modules/phonegap/node_modules/cordova/bin:/usr/local/bin 导出PATH = $ PATH:/ usr / local / lib / node_modules / phonegap / node_modules / cordova / bin:/ usr / local / bin

now add platform like : cordova platform add android 现在添加平台,如:cordova平台添加android

the platform will be added. 该平台将被添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM