Flutter Engine crash due to GeneratedPluginRegistrant not found

40 Views Asked by At

I get this error:

Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@244bb9a) but could not find or invoke the GeneratedPluginRegistrant.
2024-03-06 18:00:35.069 17341-17341 GeneratedP...nsRegister <package>  E  Received exception while registering
                                                                                                    java.lang.ClassNotFoundException: io.flutter.plugins.GeneratedPluginRegistrant

The build used to work fine, it started to happen after doing a clean and clearing Android Studio cache. Now even on a clean checkout of my code i get the same error.

It happens on this line running in a custom application java file:

@Override
public void onCreate() {
  flutterEngine = new FlutterEngine(this);
}

The application runs and Android activity/Application that launches a Flutter module (Add-To-app). Flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.3, on Microsoft Windows [Version 10.0.19045.4046], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.8.6)
    ! Unable to locate a Windows 10 SDK. If building fails, install the Windows 10 SDK in Visual Studio.
[√] Android Studio (version 2023.2)
[√] VS Code, 32-bit edition (version 1.83.1)
[√] Connected device (4 available)
[√] Network resources
1

There are 1 best solutions below

0
KUSHAL MUNJAL On

As you have clean the caches update the dependency or pubsec.yaml file and also try to run flutter channel stable & flutter upgrade in terminal of your project and try to execute the project