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
- 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
Overview
Upgrade Capacitor from v4 to v7 to restore active support and get the latest native plugin APIs.
Prerequisites
Before upgrading, explicitly set
androidSchemeincapacitor.config.tsto prevent a WebView origin change that would wipe local storage data:Scope
1. CLI and core
2. Update all Capacitor plugins to v7
3. Update Android project
android/build.gradleminimum SDK version to 23 (required by Cap 7)4. Remove
@codetrix-studio/capacitor-google-authcompatibility check5. Remove
@awesome-cordova-pluginsif no longer needed@awesome-cordova-plugins/fileandcordova-plugin-fileare still required@capacitor/filesystem, remove Cordova bridge pluginsAcceptance Criteria
npx cap synccompletes without errors