Skip to content

refactor(android)!: drop legacy @NativePlugin annotation support - #8558

Draft
OS-ruimoreiramendes wants to merge 2 commits into
nextfrom
fix/RMET-5305/drop-native-plugin
Draft

refactor(android)!: drop legacy @NativePlugin annotation support#8558
OS-ruimoreiramendes wants to merge 2 commits into
nextfrom
fix/RMET-5305/drop-native-plugin

Conversation

@OS-ruimoreiramendes

@OS-ruimoreiramendes OS-ruimoreiramendes commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

Removes the legacy @NativePlugin annotation and its associated permission/activity result machinery, as part of the Capacitor 9 cleanup. @NativePlugin has been @Deprecated since Capacitor 3.0.0 (May 2021) in favor of @CapacitorPlugin.

This PR closes RMET-5305 (decision spike + implementation) and also covers the conditional cluster from RMET-5304 that was deferred pending this decision (see #8553 "Intentionally kept" section).

Intentionally kept (still overridden by CordovaPlugin for Cordova compatibility):
Plugin.handleRequestPermissionsResult, Plugin.handleOnActivityResult, Plugin.hasDefinedRequiredPermissions, Plugin.hasRequiredPermissions, Plugin.hasPermission, Bridge.getPluginWithRequestCode.
A follow-up ticket will refactor CordovaPlugin to enable full removal in Cap 10.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation
  • Other (CI, chores, etc.)

Rationale / Problems Fixed

Capacitor 9 is a major release, the natural moment to drop APIs that have been deprecated for several majors.
@NativePlugin has been deprecated for 5+ years, and every published plugin still using it is frozen at Capacitor 3–4 (2020–2022) with many other breaking API dependencies that already prevent it from running on modern Capacitor.

Tests or Reproductions

  • ./gradlew :capacitor-android:compileDebugJavaWithJavac and :capacitor-cordova-android:compileDebugJavaWithJavac pass with no warnings.
  • ./gradlew :capacitor-android:testDebugUnitTest passes.
  • Full ./gradlew build passes.
  • CLI regex change verified via npx cap sync android on capacitor-testapp (20 plugins discovered correctly).
  • Runtime validation on a Samsung Galaxy S24 FE (Android 16) with @capacitor/android linked locally against this branch:
    • @capacitor/camera: permission dialog + camera activity + photo delivered back.
    • @capacitor/share: 4 scenarios (success, cancel, empty payload validation, share of photo path).
    • @capacitor/geolocation (via capacitor-geolocation example-app): permission dialog, native execution, JS callback with error propagation.
    • cordova-plugin-inappbrowser: __CordovaPlugin registers, Cordova bridge interceptor routes JS to Native, InAppBrowser lifecycle completes cleanly. Confirms Cordova compatibility is not broken.

Platforms Affected

  • Android
  • iOS
  • Web

Notes / Comments

@OS-ruimoreiramendes OS-ruimoreiramendes changed the title Fix/rmet 5305/drop native plugin refactor(android)!: drop legacy @NativePlugin annotation support Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant