mixpanel-flutter
mixpanel-flutter copied to clipboard
Uncaught MissingPluginException after deploying web version
Hi guys, I was using mixpanel in flutter web. When I am testing it in local, it is working fine but when I deployed it on firebase hosting, it started throwing error on Mixpanel.init() with the error "Uncaught MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter)" & causing the app not be load. So please check this as it is blocking our release.
Check your code in index.html
<head>
// ~~~
<script src="flutter.js" defer></script>
<script src="./assets/packages/mixpanel_flutter/assets/mixpanel.js"></script>
</head>
It should be written END LINE OF HEAD.
I am having the same issue. My script tag is in the correct place in index.html
the package is working fine locally (in debug)
But when I deploy using firebase hosting it is throwing this error:
Uncaught MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter)
I am having this same problem in Flutter 3.10.2 with version 2.1.1.
In local environment it works correctly, but when deploying on Google App Engine the same error occurs: Uncaught MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter)
pubspec.yaml:
mixpanel_flutter: ^2.1.1 # https://pub.dev/packages/mixpanel_flutter
index.html (at the end):
<head>
...
<script src="./assets/packages/mixpanel_flutter/assets/mixpanel.js"></script>
</head>
For me the error was: PlatformException: Cannot read properties of undefined (reading 'init'), null, null)
.
Adding this to index.html
fix the issue for both release and debug builds:
<head>
...
<script src="./assets/packages/mixpanel_flutter/assets/mixpanel.js"></script>
</head>
PlatformException: Cannot read properties of undefined (reading 'init'), null, null)
is caused by a missing script tag, but MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter)
occurs even with the tag in place.
https://github.com/mixpanel/mixpanel-flutter/issues/91 suggests that the error occurs due to ad blockers, but I have the same issue even if all ad blockers are disabled and all calls to the mixpanel CDN returns 200
. Both in chrome and firefox.
Any updates on this issue as I am currently facing the similar issue after deployed to Firebase Hosting.
Still having the issue in production, also on firebase hosting.
I did add
Still facing this issue. Is there any plan to fix it as it has been in "Open" state for long.
@tejHackerDEV What did you use to get rid of this issue? Did you use some other package?
What worked for me!!
flutter clean
flutter pub get
and then build