{"slug":"debugging-capacitor-2","title":"debugging-capacitor","summary":"Diagnoses and fixes runtime bugs in Capacitor iOS/Android apps - white/blank screen on launch, startup crashes, `\"X\" plugin is not implemented on ios/android`, `net::ERR_CLEARTEXT_NOT_PERMITTED`, App Transport Security blocks, CORS on capacitor://localhost, permission denials, li","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-12-05T18:17:31.786814Z","repo":{"url":"https://github.com/Cap-go/capgo-skills","stars":79,"forks":4,"license":"MIT","updatedAt":"2026-12-05T16:44:30Z"},"bodyHtml":"<hr>\n<h2>name: debugging-capacitor\ndescription: Diagnoses and fixes runtime bugs in Capacitor iOS/Android apps - white/blank screen on launch, startup crashes, <code>\"X\" plugin is not implemented on ios/android</code>, <code>net::ERR_CLEARTEXT_NOT_PERMITTED</code>, App Transport Security blocks, CORS on capacitor://localhost, permission denials, live reload not connecting, and Capacitor 8.5+ UIScene regressions (appUrlOpen, universal links, pause/resume silent because AppDelegate callbacks stopped). Covers Safari Web Inspector, chrome://inspect, Xcode/LLDB, Android Studio, <code>npx cap run --url</code> (Capacitor 9) vs <code>-l --host</code> (8), <code>xcrun simctl openurl|privacy|push</code>, <code>xcrun devicectl device process launch|openURL</code>, <code>xctrace</code>. Do not use for only reading device logs (ios-android-logs), the UIScene migration itself (capacitor-uiscene-migration), deep-link setup (capacitor-deep-linking), speed (capacitor-performance), crash SDKs (capacitor-native-observability), tests (capacitor-testing), or upgrades/build errors (capacitor-app-upgrades, cocoapods-to-spm).</h2>\n<h1>Debugging Capacitor Apps</h1>\n<p>Find which layer is broken (web, bridge, native, OS config), prove it with the right inspector, then fix the smallest thing.</p>\n<h2>When to Use</h2>\n<p>TRIGGER when:</p>\n<ul>\n<li>App shows a white/blank screen, crashes on launch, or freezes after a native call.</li>\n<li>Error <code>\"&lt;Name&gt;\" plugin is not implemented on ios|android</code> or <code>\"&lt;Name&gt;.&lt;method&gt;()\" is not implemented on ...</code>.</li>\n<li>Network calls fail on device only: <code>net::ERR_CLEARTEXT_NOT_PERMITTED</code>, ATS \"requires the use of a secure connection\", CORS errors.</li>\n<li>Permission prompts never appear or always deny.</li>\n<li>Live reload (<code>cap run --url</code>, <code>server.url</code>) shows a blank page or \"Webpage not available\".</li>\n<li>After updating to Capacitor 8.5+ / Xcode 27: <code>appUrlOpen</code> silent, universal links open the app but do nothing, JS <code>pause</code>/<code>resume</code> or custom AppDelegate code no longer runs.</li>\n<li>User asks \"how do I debug / inspect my Capacitor app\".</li>\n</ul>\n<p>Do not use:</p>\n<ul>\n<li>Only need to stream, filter, or save logs or crash reports -&gt; <code>ios-android-logs</code>.</li>\n<li>Performing the AppDelegate -&gt; SceneDelegate migration itself -&gt; <code>capacitor-uiscene-migration</code>.</li>\n<li>Setting up deep links, AASA, assetlinks from scratch -&gt; <code>capacitor-deep-linking</code>.</li>\n<li>Jank, slow startup, bundle size, memory tuning -&gt; <code>capacitor-performance</code>.</li>\n<li>Sentry / Crashlytics / Datadog in production -&gt; <code>capacitor-native-observability</code>.</li>\n<li>Writing unit/E2E tests -&gt; <code>capacitor-testing</code>. AI/MCP device automation -&gt; <code>capacitor-mcp</code>.</li>\n<li>Gradle/Xcode build failures from version bumps -&gt; <code>capacitor-app-upgrades</code>; Pods/SPM resolution -&gt; <code>cocoapods-to-spm</code>.</li>\n<li>Push token/delivery issues -&gt; <code>capacitor-push-notifications</code>; keyboard overlap -&gt; <code>capacitor-keyboard</code>; notch/insets -&gt; <code>safe-area-handling</code>.</li>\n</ul>\n<h2>Triage Workflow</h2>\n<ol>\n<li><strong>Collect facts before touching code</strong>: platform(s), simulator vs device, debug vs release, Capacitor version (<code>npx cap doctor</code>), what changed last (upgrade, plugin added, config edit), exact error text.</li>\n<li><strong>Classify the layer</strong>:\n<ul>\n<li>JS exception, failed fetch, bad route -&gt; web layer: open the WebView inspector (Safari / <code>chrome://inspect</code>). See <code>references/webview-inspection.md</code>.</li>\n<li><code>plugin is not implemented</code> -&gt; bridge/registration: the native code is not in the binary or JS cannot be injected. See Error Handling below.</li>\n<li>Process dies / <code>EXC_BAD_ACCESS</code> / <code>FATAL EXCEPTION</code> -&gt; native layer: run from Xcode / Android Studio with the debugger attached. See <code>references/native-debugging.md</code>.</li>\n<li>Works on Android but not iOS after 8.5/Xcode 27, link/lifecycle related -&gt; UIScene. See <code>references/uiscene-regressions.md</code>.</li>\n</ul>\n</li>\n<li><strong>Reproduce with a fresh sync</strong>: <code>npm run build &amp;&amp; npx cap sync</code> then rebuild native. Stale <code>public/</code> assets and un-synced plugins cause most \"works in browser, broken on device\" reports.</li>\n<li><strong>Read the native console</strong> for Capacitor's own messages. iOS prints <code>⚡️  Loading app at ...</code>, <code>⚡️  [log] - ...</code>, <code>⚡️  ERROR: Unable to load ...</code> to <strong>stdout</strong> (visible in Xcode's console, <code>simctl launch --console-pty</code>, <code>devicectl ... launch --console</code>; not in Console.app). Android logs under tag <code>Capacitor</code> and JS console under <code>Capacitor/Console</code>. Log commands live in <code>ios-android-logs</code>.</li>\n<li><strong>Report the root cause and proposed fix to the user before invasive changes</strong> (deleting <code>ios/</code>/<code>android/</code>, editing <code>project.pbxproj</code>, disabling ATS globally).</li>\n<li>Apply the fix, then run the Verification steps.</li>\n</ol>\n<h2>Tool Matrix</h2>\n<table>\n<thead>\n<tr>\n<th>Need</th>\n<th>iOS</th>\n<th>Android</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Inspect DOM/JS/network</td>\n<td>Safari &gt; Develop &gt; device &gt; app</td>\n<td><code>chrome://inspect/#devices</code></td>\n</tr>\n<tr>\n<td>Native breakpoints</td>\n<td>Xcode (<code>npx cap open ios</code>), LLDB</td>\n<td>Android Studio debugger (<code>npx cap open android</code>)</td>\n</tr>\n<tr>\n<td>Run on target from CLI</td>\n<td><code>npx cap run ios --target &lt;id&gt;</code></td>\n<td><code>npx cap run android --target &lt;id&gt;</code></td>\n</tr>\n<tr>\n<td>List targets</td>\n<td><code>npx cap run ios --list</code></td>\n<td><code>npx cap run android --list</code></td>\n</tr>\n<tr>\n<td>Open URL / deep link</td>\n<td><code>xcrun simctl openurl booted &lt;url&gt;</code>; device: <code>xcrun devicectl device process openURL --device &lt;id&gt; &lt;url&gt;</code></td>\n<td><code>adb shell am start -W -a android.intent.action.VIEW -d \"&lt;url&gt;\" &lt;appId&gt;</code></td>\n</tr>\n<tr>\n<td>Reset/grant permissions (sim)</td>\n<td><code>xcrun simctl privacy booted reset all &lt;appId&gt;</code></td>\n<td><code>adb shell pm revoke &lt;appId&gt; android.permission.CAMERA</code> / <code>adb shell pm clear &lt;appId&gt;</code></td>\n</tr>\n<tr>\n<td>Fake push (sim)</td>\n<td><code>xcrun simctl push booted &lt;appId&gt; payload.json</code></td>\n<td>send a real FCM message</td>\n</tr>\n<tr>\n<td>Launch with stdout</td>\n<td><code>xcrun simctl launch --console-pty booted &lt;appId&gt;</code>; device: <code>xcrun devicectl device process launch --console --device &lt;id&gt; &lt;appId&gt;</code></td>\n<td><code>adb logcat</code></td>\n</tr>\n<tr>\n<td>Profile</td>\n<td>Instruments / <code>xcrun xctrace record --template 'Time Profiler'</code></td>\n<td>Android Studio Profiler</td>\n</tr>\n</tbody>\n</table>\n<p>Details and caveats: <code>references/device-cli.md</code>.</p>\n<h2>Live Reload Quick Path</h2>\n<ul>\n<li>Capacitor 9 (<code>@next</code>): <code>npx cap run ios --url http://192.168.1.68:5173</code>. The old <code>-l/--live-reload</code>, <code>--host</code>, <code>--port</code>, <code>--https</code> flags are removed.</li>\n<li>Capacitor 8.5 (stable): <code>npx cap run ios -l --host 192.168.1.68 --port 5173</code> (add <code>--https</code> for an https dev server).</li>\n<li>Android emulator/USB: <code>--forwardPorts 5173:5173</code> runs <code>adb reverse</code> so <code>http://localhost:5173</code> works.</li>\n<li>Dev server must bind to <code>0.0.0.0</code>; phone and Mac on the same Wi-Fi; iOS may ask for Local Network access; if denied the page never loads (re-enable in Settings &gt; Privacy &amp; Security &gt; Local Network).</li>\n<li>Never ship <code>server.url</code> / <code>server.cleartext</code> in <code>capacitor.config.*</code>; grep before release.</li>\n</ul>\n<h2>Error Handling</h2>\n<table>\n<thead>\n<tr>\n<th>Error / symptom</th>\n<th>Likely cause</th>\n<th>Fix</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>\"Foo\" plugin is not implemented on ios</code></td>\n<td>Plugin not in native project, or JS injection blocked</td>\n<td><code>npm i &lt;plugin&gt;</code> -&gt; <code>npx cap sync ios</code>. SPM: check <code>ios/App/CapApp-SPM/Package.swift</code> lists it; CocoaPods: check <code>ios/App/Podfile</code>. Remove <code>WKAppBoundDomains</code> from Info.plist or set <code>ios.limitsNavigationsToAppBoundDomains: true</code>.</td>\n</tr>\n<tr>\n<td><code>\"Foo\" plugin is not implemented on android</code></td>\n<td>Gradle not synced, or a service worker intercepts the page</td>\n<td><code>npx cap sync android</code>, then File &gt; Sync Project with Gradle Files. Disable/unregister service workers in the native build.</td>\n</tr>\n<tr>\n<td><code>\"Foo.bar()\" is not implemented on web</code></td>\n<td>Calling a native-only method in the browser</td>\n<td>Guard with <code>Capacitor.isNativePlatform()</code> / <code>Capacitor.isPluginAvailable('Foo')</code>.</td>\n</tr>\n<tr>\n<td><code>⚡️  ERROR: Unable to load .../index.html</code> / white screen</td>\n<td><code>webDir</code> wrong or never copied</td>\n<td>Build web, verify <code>webDir</code> matches output folder, <code>npx cap copy</code>.</td>\n</tr>\n<tr>\n<td>White screen, no native error</td>\n<td>JS crash before first render, or bad <code>&lt;base href&gt;</code> / absolute asset paths</td>\n<td>Inspect WebView console; use relative/root paths that resolve under <code>capacitor://localhost</code> / <code>https://localhost</code>.</td>\n</tr>\n<tr>\n<td><code>net::ERR_CLEARTEXT_NOT_PERMITTED</code></td>\n<td>Android blocks HTTP (API 28+)</td>\n<td>Use HTTPS. For dev only: <code>server.cleartext: true</code> or a <code>network_security_config.xml</code> scoped to the dev host.</td>\n</tr>\n<tr>\n<td>\"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.\"</td>\n<td>iOS ATS</td>\n<td>Use HTTPS. For dev only: <code>NSExceptionDomains</code> for the dev host, not global <code>NSAllowsArbitraryLoads</code>.</td>\n</tr>\n<tr>\n<td>CORS error from API on device only</td>\n<td>Origin is <code>capacitor://localhost</code> (iOS) / <code>https://localhost</code> (Android)</td>\n<td>Allow those origins server-side, or enable <code>CapacitorHttp</code> (<code>plugins.CapacitorHttp.enabled: true</code>) to route <code>fetch</code>/XHR natively.</td>\n</tr>\n<tr>\n<td>Crash on permission request (iOS, <code>This app has crashed because it attempted to access privacy-sensitive data without a usage description</code>)</td>\n<td>Missing <code>NS*UsageDescription</code></td>\n<td>Add the key to <code>ios/App/App/Info.plist</code>.</td>\n</tr>\n<tr>\n<td>Permission always <code>denied</code> on Android</td>\n<td>Missing <code>&lt;uses-permission&gt;</code> or user chose \"Don't allow\" twice</td>\n<td>Add to <code>AndroidManifest.xml</code>; guide user to settings.</td>\n</tr>\n<tr>\n<td><code>No such module 'Capacitor'</code> (Xcode)</td>\n<td>Opened <code>.xcodeproj</code> with CocoaPods, or SPM packages not resolved</td>\n<td>Pods: open <code>App.xcworkspace</code>, <code>npx cap sync ios</code>. SPM: File &gt; Packages &gt; Reset Package Caches. Deeper -&gt; <code>cocoapods-to-spm</code>.</td>\n</tr>\n<tr>\n<td><code>Unable to boot device in current state: Booted</code></td>\n<td>Simulator already running</td>\n<td>Not an error; use <code>booted</code> as the device id.</td>\n</tr>\n<tr>\n<td><code>appUrlOpen</code> / universal links silent on iOS only after 8.5</td>\n<td>AppDelegate <code>open url</code> / <code>continue userActivity</code> no longer called</td>\n<td>See <code>references/uiscene-regressions.md</code>.</td>\n</tr>\n<tr>\n<td>JS <code>pause</code>/<code>resume</code> stop firing</td>\n<td>Custom SceneDelegate missing proxy forwarding, or logic left in <code>applicationDidEnterBackground</code></td>\n<td>See <code>references/uiscene-regressions.md</code>.</td>\n</tr>\n</tbody>\n</table>\n<p>More symptom-specific fixes: <code>references/common-failures.md</code>.</p>\n<h2>Verification</h2>\n<p>After any fix, prove it:</p>\n<ol>\n<li><code>npx cap doctor</code> shows matching <code>@capacitor/core</code>, <code>cli</code>, <code>ios</code>, <code>android</code> versions.</li>\n<li><code>npm run build &amp;&amp; npx cap sync</code> completes with no warnings about missing plugins.</li>\n<li>Native console shows <code>⚡️  Loading app at capacitor://localhost...</code> (iOS) / no <code>Capacitor/Console</code> errors (Android).</li>\n<li>WebView inspector console is clean on launch.</li>\n<li>Re-run the exact repro on both a simulator/emulator and a physical device, in a <strong>release</strong> build if the bug was release-only (<code>cap run</code> builds Debug by default; iOS accepts <code>--configuration Release</code>, Android release builds go through Android Studio or Gradle).</li>\n<li>For link/lifecycle fixes: test cold (app killed) and warm (app backgrounded) launch with <code>simctl openurl</code> / <code>adb shell am start</code>, and background/foreground once to see <code>pause</code> and <code>resume</code>.</li>\n<li>Before shipping: <code>grep -n \"server\" capacitor.config.*</code> shows no <code>url</code>/<code>cleartext</code> left over.</li>\n</ol>\n<h2>References</h2>\n<p>Only load a reference when its topic is in play.</p>\n<table>\n<thead>\n<tr>\n<th>File</th>\n<th>Load when</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>references/webview-inspection.md</code></td>\n<td>Attaching Safari/Chrome inspectors, inspector shows no app, debugging release builds, early-startup JS errors</td>\n</tr>\n<tr>\n<td><code>references/native-debugging.md</code></td>\n<td>Native crash, breakpoints in plugins, LLDB, Android Studio debugger, Instruments/xctrace, memory leaks</td>\n</tr>\n<tr>\n<td><code>references/device-cli.md</code></td>\n<td>Driving simulators/devices from the terminal: install, launch, open URLs, permissions, push, app containers</td>\n</tr>\n<tr>\n<td><code>references/uiscene-regressions.md</code></td>\n<td>iOS deep links, universal links, cold-start URL, pause/resume, or AppDelegate code broken after Capacitor 8.5 / Xcode 27</td>\n</tr>\n<tr>\n<td><code>references/common-failures.md</code></td>\n<td>Detailed fixes for white screen, plugin not implemented, networking, permissions, live reload</td>\n</tr>\n</tbody>\n</table>\n<h2>Resources</h2>\n<ul>\n<li><a href=\"https://capacitorjs.com/docs/ios/troubleshooting\">https://capacitorjs.com/docs/ios/troubleshooting</a></li>\n<li><a href=\"https://capacitorjs.com/docs/android/troubleshooting\">https://capacitorjs.com/docs/android/troubleshooting</a></li>\n<li><a href=\"https://capacitorjs.com/docs/guides/live-reload\">https://capacitorjs.com/docs/guides/live-reload</a></li>\n<li><a href=\"https://capacitorjs.com/docs/updating/8-5\">https://capacitorjs.com/docs/updating/8-5</a></li>\n<li><a href=\"https://capacitorjs.com/docs/cli/commands/run\">https://capacitorjs.com/docs/cli/commands/run</a></li>\n</ul>\n","files":[{"path":"metadata.json","sizeBytes":1560,"isText":true},{"path":"references/common-failures.md","sizeBytes":5259,"isText":true},{"path":"references/device-cli.md","sizeBytes":4342,"isText":true},{"path":"references/native-debugging.md","sizeBytes":3325,"isText":true},{"path":"references/uiscene-regressions.md","sizeBytes":4200,"isText":true},{"path":"references/webview-inspection.md","sizeBytes":3433,"isText":true},{"path":"SKILL.md","sizeBytes":11419,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-12-05T18:20:12.730241Z","sha256":"2DF5C2DAFDE31CE535ECD40E031506A58FF357138B4083194B2EB0B54A5293D5","sizeBytes":16091},"review":null,"source":{"repositoryUrl":"https://github.com/Cap-go/capgo-skills","path":"skills/debugging-capacitor","license":"MIT","commit":"76462e3a0041ee8dd0d370c344d9fd3ae2c29cdb","subtreeSha":"F2DB50474A0DF8A4D9A8E68EE09FEE04D62302F8C5112B928A4549B24AAE04C4","lastSyncedAt":"2026-12-05T18:17:06.651351Z"},"reviewedAt":"2026-12-05T18:24:55.452331Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/Cap-go/capgo-skills/tree/main/skills/debugging-capacitor"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install cap-go-capgo-skills@llmmart"},{"target":"git","command":"git clone https://github.com/Cap-go/capgo-skills.git"}]}