Every time you change code inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Niurka77/tf-app/llms.txt
Use this file to discover all available pages before exploring further.
src/ — whether it is JavaScript logic, CSS styles, or an HTML view — those changes must go through two steps before they appear in the Android app. First, Vite compiles the source into the dist/ output directory. Then, Capacitor copies that compiled output into the Android project and reconciles any plugin or configuration changes. Skipping either step means your device or emulator will still be running stale assets.
The Build-Sync Workflow
Build the web app with Vite
Run the build script defined in Once complete,
package.json. Vite compiles everything in src/ and writes the output to dist/:dist/ will contain the production-ready index.html, bundled JS, and CSS that the Android WebView will load.Sync with the Android project
Run Capacitor’s sync command to push the new Capacitor copies web assets into
dist/ contents into the Android project and apply any plugin or config updates:android/app/src/main/assets/public/ and updates the native layer to match the current state of capacitor.config.json and installed plugins.What cap sync Does
npx cap sync performs three distinct operations every time it runs:
- Copies web assets — the entire contents of
dist/(configured as"webDir": "dist"incapacitor.config.json) are copied intoandroid/app/src/main/assets/public/, replacing whatever was there before. - Updates native plugins — if you have added or removed a Capacitor plugin (such as
@capacitor/splash-screen) since the last sync, Capacitor installs or removes the corresponding native Android module and updatessettings.gradleandbuild.gradlereferences accordingly. - Applies config changes — any modifications to
capacitor.config.json— such asappId,appName, orserversettings — are written into the appropriate native configuration files.
cap copy vs cap sync
Capacitor ships two related commands with different scopes:
| Command | What it does | When to use it |
|---|---|---|
npx cap copy | Copies web assets from dist/ to the native project only | After HTML, CSS, or JS changes when no plugins changed |
npx cap sync | Copies web assets and updates plugins and config | After installing or removing a plugin, or after capacitor.config.json changes |
Live Reload During Development
For browser-based development,npm run dev starts Vite’s dev server with hot module replacement, which is the fastest way to iterate on UI changes. However, when you need to test on a physical device or emulator, you can point the Android WebView at the running Vite dev server instead of the bundled dist/ assets.
Add a server.url to capacitor.config.json using your machine’s local network IP address:
192.168.1.100 with your machine’s actual LAN IP (find it with ipconfig on Windows or ifconfig/ip a on macOS/Linux). The "cleartext": true flag — nested inside server.android — allows the Android WebView to load from an http:// URL, which is required because Vite’s dev server does not serve over HTTPS by default. This project already ships with server.android.cleartext set to true in capacitor.config.json.
After saving the config, run npx cap sync once to push the updated config to Android, then deploy the app. The WebView will load directly from the Vite dev server and reflect code changes instantly without a rebuild-sync cycle.