ionic build- Generates the
dist/folder (Vite output).
npx cap add androidnpx cap add @capacitor-community/electronnpx cap copy android
npx cap copy electron- Copies the
dist/folder to Android and Electron.
npm run sync- Ensures Capacitor plugins are updated in native projects.
npx cap open android- Opens your Android project for building/running on device or emulator.
npm run electron:start- Runs the Electron desktop app manually (bypasses
live-runner.js).
# Build Ionic
npx ionic build
# Copy & sync platforms
npx cap copy
npx cap sync
# Android
npx cap open android
# Electron
cd electron
npx electron .cd electron
npm install
npx electron-rebuild- Needed if you use native Electron modules.
# Close Android Studio first
del /s /q %USERPROFILE%\.gradle\caches- Or from Android Studio: File → Invalidate Caches / Restart
-
Always build Ionic first (
ionic build). -
Always copy assets (
npx cap copy) after a build. -
Avoid
npx cap open electronon Windows, it uses broken live-reload scripts. -
Makes builds ignore errors from dependencies like
chokidarorbuilder-util-runtime.
Perfect — that’s the correct structure and notes for using @capacitor/assets. A few clarifications for your workflow:
assets/
├── icon-only.png # main icon, >=1024x1024
├── icon-foreground.png # optional, >=1024x1024
├── icon-background.png # optional, >=1024x1024
├── splash.png # main splash screen, >=2732x2732
└── splash-dark.png # optional dark splash, >=2732x2732
- All files are PNG or JPG.
icon-only.pngis mandatory; others are optional but recommended for proper theming.
npx @capacitor/assets generate- Will automatically generate all Android
mipmap-*icons. - Splash screens will also be generated if present.
- Plugin reads the
assets/folder by default — no--asset-pathneeded.
npx cap copy
npx cap sync- This will only generate for android for electron we need to replace in /electron/assets/