メインコンテンツまでスキップ
バージョン: v7

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'
}

Update gradle wrapper to 8.2.1

# gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Update kotlin_version

If your plugin uses kotlin, update the default kotlin_version

# build.gradle
buildscript {
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
repositories {