GetDutchie / datadog_flutter

**This community package has been deprecated in favor of Datadog's official SDK**
https://github.com/DataDog/dd-sdk-flutter
MIT License
24 stars 24 forks source link

MissingPluginException #78

Closed btrautmann closed 2 years ago

btrautmann commented 2 years ago

Hi there,

We're investigating adding datadog_flutter to our add-to-app Flutter application, and running into the following issue when invoking initialize:

2022-03-03 09:59:05.136 3583-3670/com.example.application I/flutter: [D]  GlobaErrorHandler.error  ERROR: MissingPluginException(No implementation found for method initWithClientToken on channel plugins.greenbits.com/datadog_flutter)
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: <asynchronous suspension>
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: #1      DatadogFlutter.initialize (package:datadog_flutter/datadog_flutter.dart:32:5)
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: <asynchronous suspension>
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: #2      DatadogLoggingService.init (package:core/src/logging/datadog_logging_service.dart:21:5)
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: <asynchronous suspension>
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: #3      main.<anonymous closure> (package:app_embedded/main.dart:38:7)
2022-03-03 09:59:05.384 3583-3670/com.example.application I/flutter: <asynchronous suspension>

I've cloned the repository and pointed our pubspec.yaml to my local copy via a path ref, and placed logs in both onAttachedToEngine and registerWith but neither seem to be invoked which would explain the MissingPluginException.

This is seen running on a Pixel 3 running API 30 (emulator).

flutter doctor output ``` [✓] Flutter (Channel stable, 2.8.1, on macOS 11.6.4 20G417 darwin-x64, locale en-US) • Flutter version 2.8.1 at /Users/brandontrautmann/fvm/versions/2.8.1 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 77d935af4d (3 months ago), 2021-12-16 08:37:33 -0800 • Engine revision 890a5fca2e • Dart version 2.15.1 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/brandontrautmann/Library/Android/sdk • Platform android-31, build-tools 30.0.3 • ANDROID_SDK_ROOT = /Users/brandontrautmann/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.2) • Android Studio at /Applications/Android Studio Archives/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) [✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) [✓] VS Code (version 1.64.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.34.0 [✓] Connected device (4 available) • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 11 (API 30) (emulator) • iPhone 13 (mobile) • 8ADFB0F5-C636-4F54-AB0E-325A9E60878A • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.6.4 20G417 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.109 • No issues found! ```
tshedor commented 2 years ago

Hey @btrautmann I think this is something related to the way add-to-app is registering plugins. I'm personally unfamiliar with this.

  1. Are you encountering this error on all platforms or just specific ones (Android, iOS, Web)?
  2. Have you encountered this error with any other packages?

I thought this may be related to the Flutter 1.12 migration for Android packages, but after creating a fresh package using Flutter's hello world, the calls to register the plugin with Flutter's service are all the same API.

btrautmann commented 2 years ago

Hey @btrautmann I think this is something related to the way add-to-app is registering plugins. I'm personally unfamiliar with this.

I think you may be right. I ran the same code in a standalone (i.e not add to app) flavor of our app and the SDK was able to initialize. I can dig into this more and hopefully figure out what's up.

We are, however, running into E[/Datadog]() (17917): Unable to send batch [444 bytes] (LogsOkHttpUploader) because of a network error; we will retry later. I actually saw this occur with the example app as well, so I suspect it's something on my end (corporate proxy or similar), but if you have any idea off the top of your head please let me know :)

btrautmann commented 2 years ago

Ok, this one was on me. We run a monorepo setup and while I ran pub get for the package importing this plugin, I failed to do so for the entire repo (which would include the embedded app package), and after doing so and re-deploying, everything began working as expected, so closing this.

tshedor commented 2 years ago

Great to hear