skip to Main Content

When running flutter run or building the application for using Third Party plugins, Flutter is supposed to generate the file GeneratedPluginRegistrant.java under app/src/main/java/io/flutter/plugins.

The AndroidManifest contains the:

<meta-data
            android:name="flutterEmbedding"
            android:value="2" />

One additional information is that, i tried to setup it on a new computer and it is not working, this was working on another Mac Silicon. I tried to delete it in the other MacSilicon and stopped working.

flutter doctor -v:

[✓] Flutter (Channel stable, 3.10.4, on macOS 13.4 22F66 darwin-arm64, locale en-JP)
    • Flutter version 3.10.4 on channel stable at /Users/andy/flutter
    • Upstream repository ssh://[email protected]/flutter/flutter.git
    • FLUTTER_GIT_URL = ssh://[email protected]/flutter/flutter.git
    • Framework revision 682aa387cf (5 weeks ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/andy/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /Users/andy/Library/Android/sdk
    • Java binary at: /Users/andy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/andy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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 17.0.6+0-17.0.6b802.4-9586694)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/andy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.10121639/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 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.3)
    • IntelliJ at /Users/andy/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
    • IntelliJ at /Users/andy/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9011.34/IntelliJ IDEA.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.3)
    • IntelliJ at /Users/andy/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9161.38/IntelliJ IDEA.app
    • 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

[✓] VS Code (version 1.80.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.68.0

[✓] Connected device (2 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64  • macOS 13.4 22F66 darwin-arm64

[✓] Network resources
    • All expected network resources are available.

• No issues found!

My pubspec.yaml

name: foo
description: Foo

version: 8.2.1+83
publish_to: none

environment:
  sdk: ">=2.17.0 <3.0.0"

dependencies:
  adapty_flutter: ^2.4.1
  app_tracking_transparency: ^2.0.3
  bloc: ^8.1.1
  cached_network_image: ^3.2.3
  cloud_firestore: ^4.4.5
  collection: ^1.17.1
  cupertino_icons: ^1.0.5
  darq: ^1.2.1
  equatable: ^2.0.5
  euc: ^1.0.6+8
  firebase_auth: ^4.3.0
  firebase_core: ^2.8.0
  firebase_storage: ^11.0.16
  flex_color_picker: ^3.1.0
  flutter:
    sdk: flutter
  flutter_bloc: ^8.1.2
  flutter_cache_manager: ^3.3.0
  flutter_i18n: ^0.33.0
  flutter_iconpicker_plus: ^3.2.3
  flutter_keyboard_visibility: ^5.4.0
  flutter_localizations:
    sdk: flutter
  flutter_native_splash: ^2.2.19
  flutter_rating_bar: ^4.0.1
  flutter_reorderable_list: ^1.3.1
  flutter_swipe_action_cell: ^3.1.0
  font_awesome_flutter: ^10.4.0
  get_it: ^7.2.0
  google_mobile_ads: ^2.3.0
  google_sign_in: ^6.0.2
  html: ^0.15.2
  http: ^0.13.4
  image_picker: ^0.8.7
  in_app_review: ^2.0.6
  intl: ^0.18.0
  launch_review: ^3.0.1
  modal_bottom_sheet: ^3.0.0-pre
  optional: ^6.1.0+1
  package_info: ^2.0.2
  path: ^1.8.2
  permission_handler: ^10.0.2
  provider: ^6.0.5
  pull_to_refresh: ^2.0.0
  receive_sharing_intent: ^1.4.5
  sentry_flutter: ^7.1.0
  share: ^2.0.4
  shared_preferences: ^2.0.18
  string_validator: ^1.0.0
  the_apple_sign_in: ^1.1.1
  url_launcher: ^6.1.10
  version: ^3.0.2
  webview_flutter: ^4.2.2

dev_dependencies:
  bloc_test: ^9.1.1
  faker: ^2.1.0
  flutter_launcher_icons: ^0.12.0
  flutter_test:
    sdk: flutter
  mocktail: ^0.3.0
  very_good_analysis: ^4.0.0

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/icon.png"

flutter_native_splash:
  image: assets/images/icon_transparent.png
  color: "#58506e"

flutter:
  uses-material-design: true
  plugin:
    platforms:
      ios:
        default_package: webview_flutter_wkwebview

  assets:
    - assets/images/icon_transparent.png
    - assets/images/hoshimon_ads.jpg
    - assets/images/mountains.jpg
    - assets/images/line_logo.png
    - assets/flutter_i18n/en.json
    - assets/flutter_i18n/ja.json
    - assets/images/tutorial/ja/extracted.png
    - assets/images/tutorial/ja/list.png
    - assets/images/tutorial/ja/share_highlight.png
    - assets/images/tutorial/ja/share_highlight_button.png
    - assets/images/tutorial/ja/share_other_selection.png
    - assets/images/tutorial/ja/share_settings_highlight_app.png
    - assets/images/tutorial/en/extracted.png
    - assets/images/tutorial/en/list.png
    - assets/images/tutorial/en/share_highlight.png
    - assets/images/tutorial/en/share_highlight_button.png
    - assets/images/tutorial/en/share_other_selection.png
    - assets/images/tutorial/en/share_settings_highlight_app.png
    - assets/images/rating/heart.png
    - assets/images/rating/heart_empty.png
    - assets/images/rating/heart_half.png
    - assets/images/subscription_thank_you.png

The File to be Generated and the Plugins are integrated. I Already tried to:

  • Reinstall Flutter
  • Reinstall Flutter and Dart Plugin for Android Studio
  • Try to different IDE like VSCode or Even running on terminal
  • Try different JDK versions, 17,18,20.
  • Try to run gradlew clean and gradlew build
  • Rename the Project or move the project from folders
  • flutter clean && flutter pub get
  • flutter pub cache clean
  • Deleted all cached files such as .dart_tool, .gradle.
  • Deleted the local repository and tried to clone again via git clone in a fresh folder
  • Invalidate Cache of the Editors and IDEs
  • Upgrade dependencies

2

Answers


  1. Chosen as BEST ANSWER

    The following statement in the pubspec.yml is overriding the platform of the application and treating the flutter app as a package.

      plugin:
        platforms:
          ios:
            default_package: webview_flutter_wkwebview 
    

  2. The GeneratedPluginRegistrant.java file is generated automatically when you build the project. If the file is not being created, this suggests a problem with either the build process or the Flutter configuration.

    Given that you have already tried most of the recommended solutions like Flutter reinstall, flutter clean, flutter pub cache repair, moving project folder, changing JDK versions, it seems like an unusual issue.

    Here are a few additional steps to consider:

    1. Update Flutter and Dart SDKs: Ensure that you’re using the latest versions of the Flutter and Dart SDKs. If not, update them.

    2. Update Dependencies: Update all the dependencies in your pubspec.yaml to the latest version. This may solve compatibility issues, if any.

    3. Gradle Version: Check your Gradle version in android/gradle/wrapper/gradle-wrapper.properties. Make sure it’s compatible with the version of Flutter you’re using.

    4. Check AndroidManifest.xml: Make sure that the AndroidManifest.xml file inside the android/app/src/main directory is properly set up and does not have any errors.

    5. Check for Errors: Run flutter build apk --debug and check the output for any specific errors related to plugin registration. This might give more insight into what’s causing the issue.

    6. Platform Compatibility: Ensure all the plugins are compatible with the platform version you’re targeting in your build.gradle file.

    7. Re-add plugins: As a last resort, you could try removing all plugins from the pubspec.yaml, run flutter clean and then re-add them one by one, running flutter packages get and then a build after each one.

    Remember to always close the project and reopen after making significant changes like upgrading Flutter or plugins. Also, always run flutter clean and flutter packages get after these changes.

    As this is quite an unusual issue, you may also consider reporting it on Flutter’s Github repository, along with all the details, so that the Flutter team and community can provide further insights.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search