flutter config_error ai_generated true

MissingPluginException: No implementation found for method on channel com.example.app/channel: Plugin not registered for Android/iOS

ID: flutter/plugin-not-implemented-android-ios

Also available as: JSON · Markdown · 中文
85%Fix Rate
85%Confidence
1Evidence
2024-02-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Flutter 3.22 active
Android 14 active
iOS 17 active

Root Cause

A Flutter plugin's native code is not properly registered in the Android MainActivity or iOS AppDelegate.

generic

中文

Flutter插件的原生代码未在Android MainActivity或iOS AppDelegate中正确注册。

Workarounds

  1. 90% success For Android: In android/app/src/main/kotlin/.../MainActivity.kt, ensure the plugin is registered in the FlutterEngine. Example: override fun configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine); flutterEngine.plugins.add(MyPlugin()) }
    For Android: In android/app/src/main/kotlin/.../MainActivity.kt, ensure the plugin is registered in the FlutterEngine. Example: override fun configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine); flutterEngine.plugins.add(MyPlugin()) }
  2. 85% success For iOS: In ios/Runner/AppDelegate.swift, ensure GeneratedPluginRegistrant.register(with: self) is called in application(_:didFinishLaunchingWithOptions:). If not, add it.
    For iOS: In ios/Runner/AppDelegate.swift, ensure GeneratedPluginRegistrant.register(with: self) is called in application(_:didFinishLaunchingWithOptions:). If not, add it.
  3. 80% success Regenerate the platform-specific code by running 'flutter pub upgrade' and then 'flutter build ios' or 'flutter build apk' to force plugin registration.
    Regenerate the platform-specific code by running 'flutter pub upgrade' and then 'flutter build ios' or 'flutter build apk' to force plugin registration.

中文步骤

  1. For Android: In android/app/src/main/kotlin/.../MainActivity.kt, ensure the plugin is registered in the FlutterEngine. Example: override fun configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine); flutterEngine.plugins.add(MyPlugin()) }
  2. For iOS: In ios/Runner/AppDelegate.swift, ensure GeneratedPluginRegistrant.register(with: self) is called in application(_:didFinishLaunchingWithOptions:). If not, add it.
  3. Regenerate the platform-specific code by running 'flutter pub upgrade' and then 'flutter build ios' or 'flutter build apk' to force plugin registration.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Cleaning doesn't affect native plugin registration; the issue is in the native code setup.

  2. 75% fail

    The error persists if the native side isn't updated to register the new version's methods.

  3. 85% fail

    The plugin is already declared; the issue is at the native level, not the Dart side.