π¦ ClawHub
Capacitor Expert
by @robingenz
A comprehensive starting point for AI agents to work with Capacitor. Covers core concepts, CLI, app creation, plugins, framework integration, best practices,...
π‘ Examples
# 1. Create a web app (React example with Vite)
npm create vite@latest my-app -- --template react-ts
cd my-app && npm install2. Install Capacitor
npm install @capacitor/core
npm install -D @capacitor/cli3. Initialize Capacitor
npx cap init "My App" com.example.myapp --web-dir dist4. Build web assets
npm run build5. Add platforms
npm install @capacitor/android @capacitor/ios
npx cap add android
npx cap add ios6. Sync and run
npx cap sync
npx cap run android
npx cap run ios
Web asset directories by framework:
dist//browser (Angular 17+ with application builder)distdistwwwFor the full guided creation flow, see capacitor-app-creation.
π Tips & Best Practices
Android
npx cap sync fails: Verify @capacitor/core and @capacitor/cli versions match. Run cd android && ./gradlew clean.cd android && ./gradlew clean, then rebuild.npx cap sync after plugin installation. Verify Gradle sync completed.ANDROID_HOME is set. Install missing SDK versions via Android Studio SDK Manager.iOS
npx cap sync ios. For CocoaPods: cd ios/App && pod install --repo-update.ios/App/Pods and re-run pod install.webDir in capacitor.config.ts matches the actual build output directory.General
--external flag.npx cap sync. Verify plugin is in package.json dependencies.Capacitor is not defined: Install @capacitor/core (npm install @capacitor/core).For full troubleshooting, see Android Troubleshooting and iOS Troubleshooting.
TERMINAL
clawhub install capacitor-expert