Skip to content

Commit a7c4027

Browse files
committed
docs(docs): cover platform packages, NgModule apps and adb reverse in the Capacitor guide
A first device run hit three gaps: npx cap add fails without @capacitor/android or @capacitor/ios, ionic start makes an NgModule app that bootstraps with bootstrapModule, and the bundled build sample needs adb reverse on an emulator or USB phone.
1 parent b34805e commit a7c4027

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎apps/docs/src/content/guides/capacitor.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ A bundled build loads the app from `capacitor://localhost` on iOS and from `http
8080

8181
The overlay is bundled into the app here, so install the package in the app first, even when the server runs on its own. See [Installation](../getting-started/installation.md).
8282

83+
If the app has no native project yet, install the platform package before you add it: `npm i @capacitor/android`, then `npx cap add android`, or `npm i @capacitor/ios`, then `npx cap add ios`. Without the package, `npx cap add` fails with `Could not find the android platform`.
84+
8385
### Start the overlay
8486

8587
```ts {8-14}
@@ -101,6 +103,10 @@ bootstrapApplication(App, appConfig)
101103
.catch((err) => console.error(err));
102104
```
103105

106+
An NgModule app, such as one from `ionic start` with NgModules, starts with `platformBrowserDynamic().bootstrapModule(AppModule)`. Add the same `.then(...)` block to that call.
107+
108+
On an Android emulator or a phone on USB, `localhost` reaches your machine only after `adb reverse tcp:9999 tcp:9999`, with your server's port. Run it again after the device restarts. A phone on Wi-Fi uses your machine's network address instead, as in [The connection info](#the-connection-info).
109+
104110
Started with `--host 0.0.0.0`, the standalone CLI prints this call with your network address and its whole connection info, config included, ready to paste.
105111

106112
The `ngDevMode` check keeps the overlay out of production builds, which also have no `ng` debug global to read. So build the app with the development configuration before you sync it, for example `ng build --configuration development`.

0 commit comments

Comments
 (0)