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

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

  1. Edit source files in www/ - Never edit platform-specific copies directly
  2. Both platforms should match - After sync, android/.../assets/public/ and ios/App/App/public/ should be identical
  3. Capacitor handles sync - npx cap sync copies files from www/ to platform directories
  4. 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.js and cordova_plugins.js files. These are harmless but should be removed if not using Cordova compatibility.
  • Capacitor runtime: Capacitor generates capacitor.js and capacitor_plugins.js during sync - these are auto-generated and should not be manually edited.