Updating from Capacitor 7 to Capacitor 8
In this guide, you'll find steps to update your project to the current Capacitor 8 version as well as a list of breaking changes for our official plugins.
Breaking changes in Capacitor config file
appendUserAgent had a bug on iOS that appended two whitespaces before appending the user agent and has been fixed. If you want to prevent the user agent change, add an extra whitespace on ios.appendUserAgent. Don't do it on the root appendUserAgent as it will also add the whitespace on Android.
android.adjustMarginsForEdgeToEdge has been removed in favor of our new System Bars core plugin, which will handle edge to edge issues in modern Android.
In brief, margins handling has been removed in favor of using env / CSS variables for handling edge to edge. Read here for more information and details on how to implement in your application.
Breaking changes in @capacitor/cli
Capacitor CLI now creates iOS SPM projects as default.
While it doesn't affect existing apps, if you remove the ios folder and run npx cap add ios again, it will be created using the SPM template, if you want to use the CocoaPods template, run npx cap add ios --packagemanager CocoaPods instead.
Breaking changes in @capacitor/android
bridge_layout_main.xml file has been removed, if you were referencing it in your app code or in plugin code, use capacitor_bridge_layout_main.xml instead.
Breaking changes in @capacitor/ios
Capacitor now emits CAPBridgeViewController's notifications for viewDidAppear and for viewWillTransition, if you're using CAPBridgeViewController extensions to emit those events you should remove them.
NodeJS 22+
Capacitor 8 requires NodeJS 22 or greater. (Latest LTS version is recommended.)
Using the CLI to Migrate
Install the latest version of the Capacitor CLI to your project:
npm i -D @capacitor/cli@latest
Once installed, simply run the following to have the CLI handle the migration for you.
npx cap migrate
If any of the steps for the migration are not able to be completed, additional information will be made available in the output in the terminal. The steps for doing the migration manually are listed out below.
iOS
The following guide describes how to upgrade your Capacitor 7 iOS project to Capacitor 8.