Skip to content

GeneratedPluginRegistrant error in release #169977

Closed as not planned
Closed as not planned

Description

@gghh0408

Steps to reproduce

Version: Flutter (Channel stable, 3.32.1)

When I use the release package, MissingPluginException error occurs, but when I run the debug package, such a problem does not occur.

Then I found that in the debug version, the automatically generated GeneratedPluginRegistrant file includes these two plugins, but the GeneratedPluginRegistrant file after executing the packaging command does not.

How to solve this problem in this case?

Expected results

The debug version is consistent with the release version.

Actual results

MissingPluginException(No implementation found for method getDeviceInfo on channel dev.fluttercommunity.plus/device_info) stack=#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:368)

or

MissingPluginException(No implementation found for method openDatabase on channel com.davidmartos96.sqflite_sqlcipher) stack=#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:368)

Code sample

no code...

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.32.1, on Microsoft Windows [版本 10.0.19045.2728], locale zh-CN)
! Upstream repository https://github.com/flutter/flutter.git is not the same as FLUTTER_GIT_URL
[√] Windows Version (10 专业版 64 位, 22H2, 2009)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2022.3)
[√] Connected device (3 available)
[!] Network resources
X A cryptographic error occurred while checking "https://storage.flutter-io.cn": Handshake error in client
You may be experiencing a man-in-the-middle attack, your network may be compromised, or you may have malware installed on your computer.
X A network error occurred while checking "https://github.com/": Failed host lookup: 'github.com'

Activity

  1. added
    in triage
    on Jun 4, 2025
  2. tirth-patel-nc commented on Jun 4, 2025

    @tirth-patel-nc
    Member

    thanks for reporting. based on the error logs, this seems related to the device_info_plus and sqflite_sqlcipher packages rather than flutter itself. it's hard to investigate further without more context.

    for us to further investigate this issue, please provide a completed and minimal reproducible code sample that doesn’t include 3rd party plugins or complex production code. Thank you!

  3. added
    waiting for response
    on Jun 4, 2025
  4. stuartmorgan-g commented on Jun 4, 2025

    @stuartmorgan-g
    Contributor

    this seems related to the device_info_plus and sqflite_sqlcipher packages rather than flutter itself

    GeneratedPluginRegistrant is created by the flutter tool, and should include all plugins used by the application, regardless of whether they are first-party or third-party.

    When I use the release package

    Please provide the exact commands you are running, and either a project that reproduces it, or the exact steps to create such a project. We need to be able to reproduce the issue in order to investigate further.

  5. gghh0408 commented on Jun 5, 2025

    @gghh0408
    Author

    The command to compile a release version is flutter build apk. However, I believe I've identified a different issue: I noticed several missing plugins were listed under dev_dependencies instead of dependencies in my pubspec.yaml. After moving these third-party libraries to dependencies, the GeneratedPluginRegistrant could properly locate them during compilation. This behavior was consistent in both Flutter 3.22.2 (my stable version) and 3.29.2.

  6. removed
    waiting for response
    on Jun 5, 2025
  7. gghh0408 commented on Jun 5, 2025

    @gghh0408
    Author

    I probably understand the difference between the two, but I'm just curious why it worked in previous versions but not in the latest one.

  8. tirth-patel-nc commented on Jun 5, 2025

    @tirth-patel-nc
    Member

    The command to compile a release version is flutter build apk. However, I believe I've identified a different issue: I noticed several missing plugins were listed under dev_dependencies instead of dependencies in my pubspec.yaml. After moving these third-party libraries to dependencies, the GeneratedPluginRegistrant could properly locate them during compilation. This behavior was consistent in both Flutter 3.22.2 (my stable version) and 3.29.2.

    Added those 2 plugins under dev_dependencies and APK built fine for me.

    Image
  9. added
    waiting for response
    on Jun 5, 2025
  10. gghh0408 commented on Jun 5, 2025

    @gghh0408
    Author

    I have obtained a streamlined version of the code and hope it will be helpful to you. In fact, as I mentioned above, after modifying the location, it worked properly, but this seems a bit strange. Below is a screenshot of my Android Studio version. Could the reason for the anomaly be that this version is too old and incompatible with Gradle? I am confused and hope to get an answer.

    Image

    I can't upload the compressed package of my temporary test project here, so please visit this link.

    https://github.com/gghh0408/TestProject

    I hope it will be helpful to you.

  11. removed
    waiting for response
    on Jun 5, 2025
  12. gghh0408 commented on Jun 5, 2025

    @gghh0408
    Author

    编译正式版的命令是 Flutter build apk。但是,我相信我已经发现了一个不同的问题:我注意到在我的 pubspec.yaml 中,几个缺失的插件列在 dev_dependencies 而不是依赖项下。将这些第三方库移动到依赖项后,GeneratedPluginRegistrant 可以在编译过程中正确定位它们。这种行为在 Flutter 3.22.2(我的稳定版本)和 3.29.2 中是一致的。

    在 dev_dependencies 和 APK 下添加了那 2 个插件,为我构建得很好。

    图像

    The situation on my side is that the APK can also be successfully compiled. However, the automatically generated GeneratedPluginRegistrant file contains fewer entries than those when running in debug mode. Interestingly, the missing plugins are exactly those configured in dev_dependencies.

    I'm not sure if this is caused by incompatible environment variables. If possible, please try compiling the simple project I provided above to see.

  13. stuartmorgan-g commented on Jun 5, 2025

    @stuartmorgan-g
    Contributor

    I noticed several missing plugins were listed under dev_dependencies instead of dependencies in my pubspec.yaml. After moving these third-party libraries to dependencies, the GeneratedPluginRegistrant could properly locate them during compilation.

    In that case, the observed behavior is correct, so closing.

    I probably understand the difference between the two, but I'm just curious why it worked in previous versions but not in the latest one.

    Including native code from dev dependencies in release builds was a long-standing bug which was recently fixed.

  14. added
    r: invalid
    and removed
    in triage
    on Jun 5, 2025
  15. github-actions commented on Jun 19, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalid

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions