Christian
Christian

Reputation: 26387

Error while adding the Android platform to a cordova project

I started a fresh Cordova project via:

cordova create project com.pro.ject Project

When I added:

cordova platform add android

I got the error:

Downloading cordova library for android...
Download complete
Creating android project...

C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.
js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\lib\check_
reqs.js:87:29
    at _rejected (C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin
\node_modules\q\q.js:808:24)
    at C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\node_modul
es\q\q.js:834:30
    at Promise.when (C:\Users\myself\.cordova\lib\android\cordova\3.5.1\
bin\node_modules\q\q.js:1079:31)
    at Promise.promise.promiseDispatch (C:\Users\myself\.cordova\lib\and
roid\cordova\3.5.1\bin\node_modules\q\q.js:752:41)
    at C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\node_modul
es\q\q.js:574:44
    at flush (C:\Users\myself\.cordova\lib\android\cordova\3.5.1\bin\nod
e_modules\q\q.js:108:17)
    at process._tickCallback (node.js:415:13)
Error: cmd: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\myself\AppData\Roaming\npm\node_m
odules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5

At the same time Eclipse can successfully create phonegap project and compile them towards android but the cordova.exe doesn't recognise the projects created by Eclipse as Cordova projects.

Upvotes: 0

Views: 1693

Answers (2)

user2378562
user2378562

Reputation: 46

Add both

\android-sdks\tools

and

\android-sdks\platform-tools

to your path and it works

Upvotes: 3

Shammoo
Shammoo

Reputation: 1103

As stated by this dude

Here is sample mistake on create new project with cordova,

cordova create abc com.example.abc ABC

abc would same with com.example.abc, if the project will be created no error, when you build app would show strange error like above. hope this can help someone.

Upvotes: 0

Related Questions