Skip to main content
Version: v8

Updating from Capacitor 8 to Capacitor 9

In this guide, you'll find steps to update your project to the current Capacitor 9 version as well as a list of breaking changes.

Breaking changes in @capacitor/android

Capacitor 9 removes the Java APIs that were deprecated in previous major versions. If your app or plugin still uses any of them, replace them as follows.

RemovedReplacement
CapConfig(AssetManager, JSONObject) constructorCapConfig.loadDefault(Context) to load from capacitor.config.json, or CapConfig.Builder for embedded use
CapConfig.getObject(String), getString(...), getBoolean(...), getInt(...), getArray(...)The typed getters on CapConfig for main config values and the PluginConfig accessors for plugin config values
PluginCall.save()setKeepAlive(true)
PluginCall.isSaved()isKeptAlive()
PluginCall.hasOption(String)Typed accessors (getString(...), getInt(...), etc.)
PluginCall.isReleased()No replacement, released calls are managed by the bridge
Bridge.CAPACITOR_HTTPS_INTERCEPTOR_STARTCAPACITOR_HTTP_INTERCEPTOR_START, all proxied requests are handled by it
Plugin.getConfigValue(String)getConfig() and the typed accessors on PluginConfig
MessageHandler(Bridge, WebView, Object) constructorMessageHandler(Bridge, WebView)

Removal of the legacy @NativePlugin annotation

The @NativePlugin annotation, deprecated since Capacitor 3.0 in favor of @CapacitorPlugin, has been removed in Capacitor 9 along with the deprecated permission and activity-result APIs that only existed to support it. For the overall migration pattern (annotation switch, callback-based activity and permission results, new Permissions API), see the Capacitor 3 plugin migration guide. The specific method replacements removed in this release are listed below.

RemovedReplacement
@NativePlugin@CapacitorPlugin
Plugin.saveCall(PluginCall)Bridge.saveCall(PluginCall) or PluginCall.setKeepAlive(true)
Plugin.getSavedCall() (no-arg)Bridge.getSavedCall(String)
Plugin.freeSavedCall()PluginCall.release(Bridge)
Plugin.hasDefinedPermissions(String[])Plugin.isPermissionDeclared(String)
Plugin.pluginRequestPermission(String, int)Plugin.requestPermissionForAlias(...) with @PermissionCallback
Plugin.pluginRequestPermissions(String[], int)Plugin.requestPermissionForAliases(...) with @PermissionCallback
Plugin.pluginRequestAllPermissions()Plugin.requestAllPermissions(PluginCall, String) with @PermissionCallback
Plugin.startActivityForResult(PluginCall, Intent, int)Plugin.startActivityForResult(PluginCall, Intent, String) with @ActivityCallback
Bridge.startActivityForPluginWithResult(PluginCall, Intent, int)Plugin.startActivityForResult(PluginCall, Intent, String) with @ActivityCallback