You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.2 KiB
2.2 KiB
Web Assets Structure - Android and iOS Parity
Author: Matthew Raymer
Date: November 4, 2025
Source of Truth
The www/ directory is the source of truth for web assets. Both Android and iOS app directories should match this structure.
Directory Structure
www/ # Source of truth (edit here)
├── index.html # Main test interface
android/app/src/main/assets/ # Android (synced from www/)
├── capacitor.plugins.json # Auto-generated by Capacitor
└── public/ # Web assets (must match www/)
└── index.html # Synced from www/index.html
ios/App/App/ # iOS (synced from www/)
├── capacitor.config.json # Capacitor configuration
└── public/ # Web assets (must match www/)
└── index.html # Synced from www/index.html
Synchronization
Both android/app/src/main/assets/public/ and ios/App/App/public/ should match www/ after running:
# Sync web assets to both platforms
npx cap sync
# Or sync individually
npx cap sync android
npx cap sync ios
Key Points
- Edit source files in
www/- Never edit platform-specific copies directly - Both platforms should match - After sync,
android/.../assets/public/andios/App/App/public/should be identical - Capacitor handles sync -
npx cap synccopies files fromwww/to platform directories - Auto-generated files -
capacitor.plugins.json,capacitor.js, etc. are generated by Capacitor
Verification
After syncing, verify both platforms match:
# Check file sizes match
ls -lh www/index.html android/app/src/main/assets/public/index.html ios/App/App/public/index.html
# Compare contents
diff www/index.html android/app/src/main/assets/public/index.html
diff www/index.html ios/App/App/public/index.html
Notes
- Cordova files: iOS may have empty
cordova.jsandcordova_plugins.jsfiles. These are harmless but should be removed if not using Cordova compatibility. - Capacitor runtime: Capacitor generates
capacitor.jsandcapacitor_plugins.jsduring sync - these are auto-generated and should not be manually edited.