Skip to content

[UPGRADE] Capacitor 4 → 7 migration #30

Description

@BAWES

Overview

Upgrade Capacitor from v4 to v7 to restore active support and get the latest native plugin APIs.

Prerequisites

⚠️ Critical: Data Loss Risk

Before upgrading, explicitly set androidScheme in capacitor.config.ts to prevent a WebView origin change that would wipe local storage data:

// capacitor.config.ts
const config: CapacitorConfig = {
  // ... existing config
  server: {
    androidScheme: 'http' // MUST be set before upgrading
  }
};

Scope

1. CLI and core

npm install -D @capacitor/cli@7
npm install @capacitor/core@7 @capacitor/android@7
npx cap migrate

2. Update all Capacitor plugins to v7

npm install \
  @capacitor/app@7 \
  @capacitor/camera@7 \
  @capacitor/filesystem@7 \
  @capacitor/geolocation@7 \
  @capacitor/haptics@7 \
  @capacitor/keyboard@7 \
  @capacitor/splash-screen@7 \
  @capacitor/status-bar@7

3. Update Android project

npx cap sync android
  • Update android/build.gradle minimum SDK version to 23 (required by Cap 7)
  • Update Gradle wrapper if prompted

4. Remove @codetrix-studio/capacitor-google-auth compatibility check

  • Verify this plugin has a Capacitor 7 compatible version or find replacement

5. Remove @awesome-cordova-plugins if no longer needed

  • Check if @awesome-cordova-plugins/file and cordova-plugin-file are still required
  • If all functionality is covered by @capacitor/filesystem, remove Cordova bridge plugins

Acceptance Criteria

  • npx cap sync completes without errors
  • Android build succeeds
  • App launches on Android emulator
  • Camera permission works
  • Filesystem read/write works
  • No Cordova bridge errors in console

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions