Skip to main content
Version: v5

Updating Capacitor to 5.0 in your plugin

iOS

Changes to CAPBridgedPlugin protocol

CAPBridgedPlugin protocol requirements have been moved to the instance level instead of the class level. pluginId was renamed identifier to avoid clashing with CAPPlugin.pluginId and the getMethod(_:) requirement was removed altogether and put into an internal extension method. pluginMethods was also updated to be more specific about its contents (was Any now is CAPPluginMethod). The vast majority of users should not experience any issues since the status quo is to use the macro to generate conformance to CAPBridgedPlugin. Any users who cast to CAPBridgedPlugin to or manually conform to CAPBridgedPlugin without the macro will be affected.

Android

Updating targetSDK / compileSDK to 33

# build.gradle

android {
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32

PluginCall.getObject() / PluginCall.getArray()

To match iOS behavior, PluginCall.getObject() and PluginCall.getArray() can now return null. We recommend plugin authors to perform null checks around code handling returns from either of these methods.

Update Android Plugin Variables

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

ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'

Update gradle plugin to 7.4.1

    dependencies {
- classpath 'com.android.tools.build:gradle:7.2.1'
+ classpath 'com.android.tools.build:gradle:7.4.1'
}

Update gradle wrapper to 7.5

# gradle-wrapper.properties

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

Move package to build.gradle

# AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="[YOUR_PACKAGE_ID]">
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
# build.gradle

android {
+ namespace "[YOUR_PACKAGE_ID]"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33

Disable Jetifier

# gradle.properties

# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
- # Automatically convert third-party libraries to use AndroidX
- android.enableJetifier=true