Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: All plugins are "not implemented on android" after upgrading to Capacitor 6 #7440

Closed
1 of 3 tasks
Linksku opened this issue May 1, 2024 · 4 comments
Closed
1 of 3 tasks
Labels
needs reproduction needs reproducible example to illustrate the issue

Comments

@Linksku
Copy link

Linksku commented May 1, 2024

Capacitor Version

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

Installed Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

[error] Xcode is not installed
[success] Android looking great! 👌

Other API Details

$ npm --version
10.6.0
$ node --version
v20.12.0

I think it affects every plugin, but confirmed the error occurs with:

"@capacitor/clipboard": "^6.0.0",
"@capacitor/geolocation": "^6.0.0",
"@capacitor/share": "^6.0.0",
"@capacitor/splash-screen": "^6.0.0",

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

Using any plugin triggers "[plugin name] plugin is not implemented on android"

Expected Behavior

No errors like in Capacitor 5

Project Reproduction

https://github.com/ionic-team/create-capacitor-app

Additional Information

I tried:

  • npx cap migrate
  • npx cap sync android
  • Deleted android folder, then npx cap add android
  • Deleted node_modules, then yarn
  • Restarted Android Studio, clean project, reload from disk, rebuild, etc
  • Created a new clean project using @capacitor/create-app

If I use my old Android build with Capacitor 5 plugins, but load a webview containing the JS for Capacitor 6 plugins, every plugin still works. Plugins all work on iOS.

@Linksku Linksku added the triage label May 1, 2024
@jcesarmobile jcesarmobile added the needs reproduction needs reproducible example to illustrate the issue label May 6, 2024
Copy link

ionitron-bot bot commented May 6, 2024

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed.
Please see the Contributing Guide for how to create a Sample App.
Thanks! Ionitron 💙

@Ionitron
Copy link
Collaborator

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day!
Ionitron 💙

@Ionitron Ionitron removed the needs reply needs reply from the user label May 22, 2024
@Venryx
Copy link

Venryx commented Jun 7, 2024

I hit this same issue, where several plugins (including the capacitor-provided "App" plugin) were "not implemented on android". (despite them clearly existing, and my seeing their initializations in the android logs)

Base situation: My app's "public" folder merely held "stub" index.html and index.js files, which would immediately redirect to my web-hosted domain at page load time.

Fix: Rather than use those "stub" files with redirection, instead I just provided my web-hosted domain as the server.url field on capacitor.config.json.

Diagnosis: I think what happened is that somewhere in the updates from Capacitor 4 to 6, the plugin-injection system was optimized to complete earlier in the page loading process. So the redirect that my "stub" index.js file wants to do, used to complete before the page redirect, whereas on Capacitor 6 it completes after the plugins were already injected, causing the newly loaded page to then lose access to those injected plugins. (EDIT: See threads below for the actual reason. It has to do with the plugin-injection code not being permitted on domains other than the start (stub/localhost) domain, unless you add this patch.)

Anyway, my redirect approach is a bit non-standard, so maybe it's not the reason for the issue you're hitting. But I figured I would mention it, since there aren't many google hits for this error message.

EDIT: Oh, I see the issue above (#7467) describes this. And following that chain, there is a also fix/workaround for it here.

Copy link

ionitron-bot bot commented Jul 7, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jul 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction needs reproducible example to illustrate the issue
Projects
None yet
Development

No branches or pull requests

4 participants