Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova serve says 404 not found

I'm just getting started to cordova.

I've created an application using

cordova create androidTest

and then

cd androidTest

cordova platform add android

cordova prepare

cordova build

and at last,

cordova serve android

which says

Static file server running at
  => http://0.0.0.0:8000/
CTRL + C to shutdown

When I open it, the only thing I get is:

404 Not Found

404 in Cordova

Why? What am I doing wrong? Did I get the meaning of cordova serve command wrong?

I am supposed to see some kind of "application" that is "rendered" in Chrome, don't I?

(using 3.1.0-0.1.0 )

like image 445
Umut Benzer Avatar asked Oct 07 '13 19:10

Umut Benzer


2 Answers

Yes, I got stung by this too.

The correct behaviour now seems to be to just run

cordova serve

and then you can navigate to

localhost:8000/<platform>/www/index.html

where platform is 'android' in your case. It doesn't seem to automatically route to index.html any more so you need to include that part of the url explicitly. There's a cordova bug here although I couldn't find any documentation on this.

like image 147
Tim Croydon Avatar answered Sep 19 '22 19:09

Tim Croydon


Clarification:

Cordova launches a server that listens on all available IP addresses on port 8000. That is what the message means when it says it's running on "0.0.0.0:8000". It doesn't mean the server is literally running on 0.0.0.0.

0.0.0.0 is not a valid IP.

like image 37
SteveSobol Avatar answered Sep 18 '22 19:09

SteveSobol