简体   繁体   中英

Flutter MissingPluginException when I use FlutterFragmentActivity

After upgrading to 1.17.3 and (1.17.3) I can't use local_auth biometric plugin anymore. Plugin requires FlutterFragmentActivity , but once I change public class MainActivity extends FlutterActivity to public class MainActivity extends FlutterFragmentActivity app would compile and run but I'd start getting MissingPluginException error for every other plugin.

Found the solution, it seems it has not been added to the local_auth documentation. Make sure to add the configureFlutterEngine override method as below after changing from FlutterActivity to FlutterFragmentActivity in the MainActivity Class

import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.embedding.android.FlutterFragmentActivity;

public class MainActivity extends FlutterFragmentActivity {
    @Override
    public void configureFlutterEngine(FlutterEngine flutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM