Can't add Android to Ionic 4 Capacitor app as www is empty

#1

I am just starting to play with Ionic 4 and Capacitor.

Following the doco, I attempted to add Android to the blank Ionic 4 application I have just created, and got the following error…

$ npx cap add android
npx: installed 1 in 2.363s
Path must be a string. Received undefined
C:\dev\ionic\sqlite-test\node_modules\@capacitor\cli\bin\capacitor
[error] The web directory (C:\dev\ionic\sqlite-test\www) must contain a "index.html".
    It will be the entry point for the web portion of the Capacitor app.

Also, even though I have been running the app (using Ionic serve), I notice my www folder is empty! So not sure where the app is building to?

Any ideas here greatly appreciated.

#2

Interesting… Ionic serve does not do a build into www. I had to run ionic build. I could then run the npx cap add android. Now I know.

1 Like