Flux uses Capacitor 6 to wrap the Vue 3 web app into native Android and iOS applications. The mobile app shares the same codebase as the web version, with platform-specific configurations managed by Capacitor.
flux/app/
├── src/ # Vue 3 app source (shared between web & mobile)
├── dist/ # Built web app (Capacitor reads from here)
├── android/ # Native Android project
├── ios/ # Native iOS project
├── capacitor.config.ts # Capacitor configuration
├── vite.config.js # Vite bundler config
└── package.json # Dependencies including Capacitor packages
@capacitor/android(6.0.0) - Android platform@capacitor/ios(6.0.0) - iOS platform@capacitor/core(6.0.0) - Core Capacitor runtime@capacitor/cli(6.0.0) - CLI tools@capacitor/push-notifications(6.0.1) - Push notification support@capacitor/status-bar(6.0.0) - Native status bar control
App ID: org.coasys.flux
App Name: flux
Web Directory: dist (where Vite builds output)
Status Bar (from capacitor.config.ts):
- Style: DARK
- Background: rgb(20, 18, 22)
-
Java Development Kit (JDK)
# Check if installed java -version javac -version # Should be JDK 11 or higher
-
Android Studio
- Download from: https://developer.android.com/studio
- Install Android SDK (API 33 or higher recommended based on config)
- Set up Android Virtual Device (AVD) for emulator testing
-
Environment Variables Add to your
~/.bashrcor~/.zshrc:export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/tools
- Xcode (from Mac App Store)
- Xcode Command Line Tools
xcode-select --install
- CocoaPods
sudo gem install cocoapods
cd /home/james/Desktop/Coding/flux/app
# Install dependencies if not already done
yarn install
# Initialize Capacitor platforms (if not already present)
# Note: android/ and ios/ folders already exist, so skip this
# npx cap add android
# npx cap add ios# Build the Vue app to dist/
yarn build
# Or run in development mode (for web testing)
yarn devAfter building, sync the web assets to native projects:
# Sync both platforms
npx cap sync
# Or sync specific platform
npx cap sync android
npx cap sync iosWhat sync does:
- Copies
dist/contents to native projects - Updates native dependencies based on package.json
- Installs/updates Capacitor plugins
Android:
# Connect Android device via USB with USB debugging enabled
# Check device is recognized
adb devices
# Run directly on device
npx cap run android
# Or open in Android Studio and click Run
npx cap open androidiOS:
# Connect iOS device via USB
npx cap run ios
# Or open in Xcode
npx cap open iosAndroid Emulator:
# Start an AVD from Android Studio first, or:
emulator -list-avds
emulator -avd <avd_name>
# Then run the app
npx cap run androidiOS Simulator:
# List available simulators
xcrun simctl list devices
# Run on simulator (opens automatically)
npx cap run iosAndroid APK:
# Build debug APK
npx cap build android
# Or build release APK (requires signing)
cd android
./gradlew assembleRelease
# APK location: android/app/build/outputs/apk/release/iOS IPA:
# Build via Xcode (requires Apple Developer account)
npx cap open ios
# Product > Archive in XcodeFor continuous development:
# Terminal 1: Run Vite dev server
yarn dev
# Terminal 2: Watch and sync changes
npx cap sync --watch
# Terminal 3: Run on device/emulator
npx cap run androidOr simplified:
# Build + sync + run in one command
yarn build && npx cap sync android && npx cap run android1. "Command not found: cap"
# Use npx to run without global install
npx cap <command>
# Or install globally
npm install -g @capacitor/cli2. Gradle build fails
cd android
./gradlew clean
# Check Java version
java -version # Should be 11 or higher3. Web app not updating in native app
# Full rebuild
yarn build
npx cap sync android
npx cap run android4. Android SDK not found
# Set ANDROID_HOME
export ANDROID_HOME=$HOME/Android/Sdk
# Or install via Android Studio SDK Manager5. Module resolution errors
# Clear caches
cd flux/app
rm -rf node_modules dist
yarn install
yarn build
npx cap syncCheck your setup:
npx cap doctor
# Check specific platform
npx cap doctor androidBased on android/app/build.gradle:
- Application ID:
org.coasys.flux - Namespace:
org.coasys.flux - Compile SDK: (defined in root gradle)
- Min SDK: (defined in root gradle - typically API 22+)
- Target SDK: (defined in root gradle - typically API 33+)
- Version Code: 1
- Version Name: "1.0"
When testing the mobile app, verify:
- App launches successfully
- AD4M connection works (local/remote)
- Authentication flow completes
- Perspectives load and display correctly
- Navigation between views works
- Push notifications work (if implemented)
- Status bar styling is correct
- Offline/online transitions handled
- No console errors in Chrome DevTools (chrome://inspect for Android)
- Network requests succeed
- Local storage persistence works
- App survives background/foreground transitions
# Connect device and open app
# In Chrome: chrome://inspect
# Click "inspect" under your app
# Or use adb logcat
adb logcat | grep -i "flux"# Enable Web Inspector on iOS device:
# Settings > Safari > Advanced > Web Inspector
# On Mac: Safari > Develop > [Your Device] > [App Name]For faster development iteration without rebuilding:
# Terminal 1: Start dev server
yarn dev --host
# Terminal 2: Point Capacitor to dev server
# Edit capacitor.config.ts temporarily:
{
server: {
url: 'http://192.168.x.x:5173', // Your machine's IP
cleartext: true
}
}
# Then sync and run
npx cap sync android
npx cap run androidNote: Remove server config before production builds!
-
Generate signing key (first time):
cd android/app keytool -genkey -v -keystore my-release-key.keystore \ -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000 -
Configure signing in
android/app/build.gradle:android { signingConfigs { release { storeFile file('my-release-key.keystore') storePassword 'password' keyAlias 'my-key-alias' keyPassword 'password' } } buildTypes { release { signingConfig signingConfigs.release } } } -
Build release APK:
yarn build npx cap sync android cd android ./gradlew assembleRelease # APK: android/app/build/outputs/apk/release/app-release.apk
- Configure in Xcode (requires Apple Developer account)
- Product > Archive
- Distribute to App Store or TestFlight
- Capacitor Documentation
- Capacitor Android Guide
- Capacitor iOS Guide
- Android Studio Setup
- Xcode Setup
# Build web app
yarn build
# Sync to native projects
npx cap sync [android|ios]
# Open native IDE
npx cap open [android|ios]
# Run on device/emulator
npx cap run [android|ios]
# Build release
npx cap build [android|ios]
# Check setup
npx cap doctor
# List installed plugins
npx cap ls
# Full rebuild workflow
yarn build && npx cap sync android && npx cap run android