Skip to main content
Version: v8

Updating Capacitor to 8.0 in your plugin

Using @capacitor/plugin-migration-v7-to-v8

From the plugin folder, run npx @capacitor/plugin-migration-v7-to-v8@latest and it will perform all the file changes automatically.

Updating the files manually

Updating Capacitor dependencies

Update @capacitor/cli, @capacitor/core, @capacitor/android and @capacitor/ios in devDependencies to ^8.0.0-alpha.3 (or use next tag during pre-release). Update @capacitor/core in peerDependencies to ^8.0.0-alpha.3 (or use next tag during pre-release).

Update Android Plugin Variables

In your build.gradle file, update the following package versions:

ext {
+ // Note: Some of the following dependencies are optional - only add/update the ones your plugin actually uses.
+ // If you use any of these dependencies, update them to the versions shown below.
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
+ androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.11.0'
+ androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.3.0'
+ androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.17.0'
+ androidxFragmentVersion = project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.8.9'
+ firebaseMessagingVersion = project.hasProperty('firebaseMessagingVersion') ? rootProject.ext.firebaseMessagingVersion : '25.0.1'
+ androidxBrowserVersion = project.hasProperty('androidxBrowserVersion') ? rootProject.ext.androidxBrowserVersion : '1.9.0'
+ androidxMaterialVersion = project.hasProperty('androidxMaterialVersion') ? rootProject.ext.androidxMaterialVersion : '1.13.0'
+ androidxExifInterfaceVersion = project.hasProperty('androidxExifInterfaceVersion') ? rootProject.ext.androidxExifInterfaceVersion : '1.4.1'
+ coreSplashScreenVersion = project.hasProperty('coreSplashScreenVersion') ? rootProject.ext.coreSplashScreenVersion : '1.2.0'
+ androidxWebkitVersion = project.hasProperty('androidxWebkitVersion') ? rootProject.ext.androidxWebkitVersion : '1.14.0'
}

Update targetSDK / compileSDK to 36 and minSDK to 24

# build.gradle

android {
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
defaultConfig {
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
+ minSdkVersion = project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
+ targetSdkVersion = project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
...
}
}

Update gradle plugin to 8.13.0

    dependencies {
- classpath 'com.android.tools.build:gradle:8.7.2'
+ classpath 'com.android.tools.build:gradle:8.13.0'
}

Update gradle wrapper to 8.14.3

# gradle-wrapper.properties

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

Update Gradle property assignment syntax

Gradle 8 deprecates the space-assignment syntax for properties. Update all property assignments to use the = operator. See the Gradle upgrade guide for more details.

The following properties commonly need to be updated from space-assignment to = assignment:

# build.gradle

android {
- compileSdk 36
+ compileSdk = 36
- namespace 'com.example.plugin'
+ namespace = 'com.example.plugin'
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
+ testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner'
defaultConfig {
- versionName '1.0.0'
+ versionName = '1.0.0'
- versionCode 1
+ versionCode = 1
}
buildTypes {
release {
- minifyEnabled false
+ minifyEnabled = false
}
}
}

compileOptions {
- sourceCompatibility JavaVersion.VERSION_21
+ sourceCompatibility = JavaVersion.VERSION_21
- targetCompatibility JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
}

lint {
- abortOnError false
+ abortOnError = false
- warningsAsErrors false
+ warningsAsErrors = false
- lintConfig file('lint.xml')
+ lintConfig = file('lint.xml')
- baseline file('lint-baseline.xml')
+ baseline = file('lint-baseline.xml')
}

repositories {
mavenCentral()
}

Note: The = operator is required for property assignments. Method calls (like mavenCentral()) remain unchanged and do not use the = operator.

We recommend using Java 21 for optimal compatibility with Android Gradle Plugin 8.13.0 and Android SDK 36, though Java 17+ is supported.

# build.gradle
compileOptions {
- sourceCompatibility JavaVersion.VERSION_17
+ sourceCompatibility = JavaVersion.VERSION_21
- targetCompatibility JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_21
}

Update kotlin_version

If your plugin uses kotlin, update the default kotlin_version to 2.2.20. This is a major version upgrade from Kotlin 1.x and includes breaking changes.

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

Kotlin 2.2 breaking changes

Kotlin 2.2.0 includes several breaking changes from Kotlin 1.x. Here are the key changes to be aware of:

  • kotlinOptions{} block: The kotlinOptions{} block in Gradle is deprecated and will raise an error. Replace it with the compilerOptions{} block (as shown below).
  • Removal of kotlin-android-extensions plugin: The kotlin-android-extensions plugin is removed. Use the kotlin-parcelize plugin for Parcelable implementation and Android Jetpack's view bindings for synthetic views.

For a complete list of breaking changes and migration guidance, see the Kotlin 2.2.0 release notes.

Update kotlinOptions to compilerOptions

Kotlin 2.0+ requires using the new compilerOptions API instead of kotlinOptions. The kotlinOptions block inside android {} is deprecated.

# build.gradle

+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+
android {
...
- kotlinOptions {
- jvmTarget = '17'
- }
}

+ kotlin {
+ compilerOptions {
+ jvmTarget = JvmTarget.JVM_21
+ }
+}

Note: Use JvmTarget.JVM_21 if you're using Java 21 (recommended), or match it to your Java version. Java 17+ is supported, but Java 21 is recommended for optimal compatibility.

Update google services plugin

# build.gradle

dependencies {
classpath 'com.android.tools.build:gradle:8.13.0'
- classpath 'com.google.gms:google-services:4.4.2'
+ classpath 'com.google.gms:google-services:4.4.4'

Raise iOS Deployment Target to 15

Update your plugin's .podspec file

-  s.ios.deployment_target = '14.0'
+ s.ios.deployment_target = '15.0'

SPM compatible plugins

Update Package.swift file

-    platforms: [.iOS(.v14)],
+ platforms: [.iOS(.v15)],

Plugins with old structure

Do the following for your Xcode project: select the Project within the project editor and open the Build Settings tab. Under the Deployment section, change iOS Deployment Target to iOS 15.0. Repeat the same steps for any app Targets.

Then, open ios/Podfile and update the iOS version to 15.0:

-platform :ios, '14.0'
+platform :ios, '15.0'

Update Capacitor SPM dependency

In SPM compatible plugins, update Package.swift file to use version 8.0.0-alpha.3

    dependencies: [
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0-alpha.3")
],