Breaking changes in code
iOS
Remove removeAllListeners method
If your plugin has CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise)
in the .m
file, it can be removed now, the method is now available for all plugins without defining it.
Add SPM support
Capacitor 6 adds experimental SPM support, you can add support for your plugin following Converting existing plugins to SPM
definitions.ts
addListener
signature has been changed to only return a Promise
, remove the & PluginListenerHandle
.
addListener(
eventName: 'resume',
listenerFunc: () => void,
- ): Promise<PluginListenerHandle> & PluginListenerHandle;
+ ): Promise<PluginListenerHandle>;
Updating Capacitor to 6.0 in your plugin
Using @capacitor/plugin-migration-v5-to-v6
From the plugin folder, run npx @capacitor/plugin-migration-v5-to-v6@latest
and it will perform all the file changes automatically.
Updating the files manually
Updating package.json
Update @capacitor/cli
, @capacitor/core
, @capacitor/android
and @capacitor/ios
to latest
version.
Replace deprecated compileSdkVersion and update targetSDK / compileSDK to 34
# build.gradle
android {
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
Update gradle plugin to 8.2.1
dependencies {
- classpath 'com.android.tools.build:gradle:8.0.0'
+ classpath 'com.android.tools.build:gradle:8.2.1'
}