Debugging Capacitor Applications
Complete guide to debugging Capacitor apps on iOS and Android.
When to Use This Skill
- User reports app crashes
- User needs to debug WebView/JavaScript
- User needs to debug native code
- User has network/API issues
- User sees unexpected behavior
- User asks how to debug
Quick Reference: Debugging Tools
WebView Debugging
iOS: Safari Web Inspector
-
Enable on device:
- Settings > Safari > Advanced > Web Inspector: ON
- Settings > Safari > Advanced > JavaScript: ON
-
Enable in Xcode (capacitor.config.ts):
-
Connect Safari:
- Open Safari on Mac
- Develop menu > [Device Name] > [App Name]
- If no Develop menu: Safari > Settings > Advanced > Show Develop menu
-
Debug:
- Console: View JavaScript logs
- Network: Inspect API calls
- Elements: Inspect DOM
- Sources: Set breakpoints
Android: Chrome DevTools
- Enable in config (capacitor.config.ts):
-
Connect Chrome:
- Open Chrome on computer
- Navigate to
chrome://inspect - Your device/emulator should appear
- Click "inspect" under your app
-
Debug features:
- Console: JavaScript logs
- Network: API requests
- Performance: Profiling
- Application: Storage, cookies
Remote Debugging with VS Code
Install "Debugger for Chrome" extension:
Native Debugging
iOS: Xcode Debugger
- Open in Xcode:
-
Set breakpoints:
- Click line number in Swift/Obj-C files
- Or use
breakpoint set --name methodNamein LLDB
-
Run with debugger:
- Product > Run (Cmd + R)
- Or click Play button
-
LLDB Console commands:
- View crash logs:
- Window > Devices and Simulators
- Select device > View Device Logs
Android: Android Studio Debugger
- Open in Android Studio:
-
Attach debugger:
- Run > Attach Debugger to Android Process
- Select your app
-
Set breakpoints:
- Click line number in Java/Kotlin files
-
Debug console:
- Logcat shortcuts:
- View > Tool Windows > Logcat
- Filter by package:
package:com.yourapp
Console Logging
JavaScript Side
Native Side (iOS)
Native Side (Android)
Common Issues and Solutions
Issue: App Crashes on Startup
Diagnosis:
Common causes:
- Missing plugin registration
- Invalid capacitor.config
- Missing native dependencies
Solution checklist:
- Run
npx cap sync - iOS:
cd ios/App && pod install - Check Info.plist permissions
- Check AndroidManifest.xml permissions
Issue: Plugin Method Not Found
Error: Error: "MyPlugin" plugin is not implemented on ios/android
Diagnosis:
Solutions:
- Ensure plugin is installed:
npm install @capgo/plugin-name - Run sync:
npx cap sync - Check plugin is registered (native code)
Issue: Network Requests Failing
Diagnosis:
Common causes:
- iOS ATS blocking HTTP: Add to Info.plist:
- Android cleartext blocked: Add to capacitor.config.ts:
- CORS issues: Use native HTTP:
Issue: Permission Denied
Diagnosis:
iOS: Check Info.plist has usage descriptions:
Android: Check AndroidManifest.xml:
Issue: White Screen on Launch
Diagnosis:
- Check WebView console for errors (Safari/Chrome)
- Check if
dist/folder exists - Verify
webDirin capacitor.config.ts
Solutions:
Issue: Deep Links Not Working
Diagnosis:
iOS: Check Associated Domains entitlement and apple-app-site-association file.
Android: Check intent filters in AndroidManifest.xml.
Performance Debugging
JavaScript Performance
iOS Performance (Instruments)
- Product > Profile (Cmd + I)
- Choose template:
- Time Profiler: CPU usage
- Allocations: Memory usage
- Network: Network activity
Android Performance (Profiler)
- View > Tool Windows > Profiler
- Select:
- CPU: Method tracing
- Memory: Heap analysis
- Network: Request timeline
Memory Debugging
JavaScript Memory Leaks
Use Chrome DevTools Memory tab:
- Take heap snapshot
- Perform action
- Take another snapshot
- Compare snapshots
iOS Memory (Instruments)
Android Memory (LeakCanary)
Add to build.gradle:
Debugging Checklist
When debugging issues:
- Check WebView console (Safari/Chrome DevTools)
- Check native logs (Xcode Console/Logcat)
- Verify plugin is installed and synced
- Check permissions (Info.plist/AndroidManifest)
- Test on real device (not just simulator)
- Try clean build (
rm -rf node_modules && npm install) - Verify capacitor.config.ts settings
- Check for version mismatches (capacitor packages)
Resources
- Capacitor Debugging Guide: https://capacitorjs.com/docs/guides/debugging
- Safari Web Inspector: https://webkit.org/web-inspector
- Chrome DevTools: https://developer.chrome.com/docs/devtools
- Xcode Debugging: https://developer.apple.com/documentation/xcode/debugging
- Android Studio Debugging: https://developer.android.com/studio/debug


