Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing PhoneGap

Tags:

cordova

This is my 2nd day at trying to install PhoneGap, so please go easy on me. Here's what I did starting this morning:

C:\Users\Phillip> npm install -g phonegap
C:\Users\Phillip> phonegap create my-app
C:\Users\Phillip> cd my-app
C:\Users\Phillip\my-app>phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
   [error] An error occured during creation of android sub-project.

C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js
:87:29
    at _rejected (C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_m
odules\q\q.js:808:24)
    at C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.
js:834:30
    at Promise.when (C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\nod
e_modules\q\q.js:1079:31)
    at Promise.promise.promiseDispatch (C:\Users\Phillip\.cordova\lib\android\co
rdova\3.3.0\bin\node_modules\q\q.js:752:41)
    at C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.
js:574:44
    at flush (C:\Users\Phillip\.cordova\lib\android\cordova\3.3.0\bin\node_modul
es\q\q.js:108:17)
    at process._tickCallback (node.js:415:13)

Edit 1:

C:\Users\Phillip\my-app>phonegap platform add android
   [error] 'platform add android' is not a node C:\Users\Phillip\AppData\Roaming
\npm\node_modules\phonegap\bin\phonegap.js command. See 'node C:\Users\Phillip\A
ppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js help'

Edit 2:

C:\Users\Phillip\my-app>%userprofile%\.cordova\lib\android\cordova\3.3.0\bin\che
ck_reqs.bat
[Error: An error occurred while listing Android targets]

Edit 3:

C:\Users\Phillip\my-app>npm install -g cordova 

Edit 4:

C:\Users\Phillip>cordova create hello com.example.hello HelloWorld
Creating a new cordova project with name "HelloWorld" and id "com.example.hello"
 at location "C:\Users\Phillip\hello"
Downloading cordova library for www...
Download complete
C:\Users\Phillip>cd hello
C:\Users\Phillip\hello>cordova platform add ios
Downloading cordova library for ios...
Download complete
Creating ios project...
'C:\Users\Phillip\.cordova\lib\ios\cordova\3.4.0\bin\create' is not recognized a
s an internal or external command,
operable program or batch file.
Error: cmd: Command failed with exit code 1
    at ChildProcess.whenDone (C:\Users\Phillip\AppData\Roaming\npm\node_modules\
cordova\src\superspawn.js:112:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)
like image 868
Phillip Senn Avatar asked Feb 21 '14 16:02

Phillip Senn


People also ask

How do I run PhoneGap?

Open the command prompt and change into the project's directory. Type '$ phonegap serve' in the command prompt or terminal app to run the project. This will return a server address.

What is PhoneGap used for?

PhoneGap is an Open Source framework that helps build hybrid applications which work on most mobile platforms such as Android, iOS, Blackberry, Windows Phone among others. Framework provides a container that bridges the native APIs to the web view.


2 Answers

Add your platform and build it first

npm install -g phonegap
phonegap create my-app
cd my-app
phonegap platform add android
phonegap platform build android
phonegap run android

And maybe use your cmd.exe in administrator mode. I lose so much time because of this..

like image 142
Clement Dungler Avatar answered Nov 16 '22 03:11

Clement Dungler


Check you have all the requirements listed in the cordova platform guide

I recently discovered a magic command that helps display what's missing to build cordova android project :

%userprofile%\.cordova\lib\android\cordova\3.3.0\bin\check_reqs.bat
like image 40
QuickFix Avatar answered Nov 16 '22 02:11

QuickFix