facundomedica / fast_qr_reader_view

A Fast QR Reader widget for Flutter. For both Android and iOS
MIT License
294 stars 163 forks source link

The new embedding does not support the old FlutterView #76

Closed firstlevelIT closed 3 years ago

firstlevelIT commented 4 years ago

There is an error at runtime.

The new embedding does not support the old FlutterView

Maybe it need a little fix.

SoftWyer commented 4 years ago

Here's a stack trace showing the problem:

Caused by: java.lang.UnsupportedOperationException: The new embedding does not support the old FlutterView.
        at io.flutter.embedding.engine.plugins.shim.ShimRegistrar.view(ShimRegistrar.java:82)
        at co.apperto.fastqrreaderview.FastQrReaderViewPlugin.registerWith(FastQrReaderViewPlugin.java:168)
        at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:18)
        at com.softwyer.collections.flutter.MainActivity.configureFlutterEngine(MainActivity.kt:17)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:178)
        at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:409)
        at android.app.Activity.performCreate(Activity.java:7825)
        at android.app.Activity.performCreate(Activity.java:7814)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)

This silently fails in the background and leaves the debug install hanging (with VSCode)

SoftWyer commented 4 years ago

I've updated my fork of the Android code so that it now supports both V1 and V2 flutter plugin templates. The example has been updated to use the V2 template. iOS has not been touched.

For the curious, it followed this guide for the plugin and this guide for the example.

The Android code has been reworked to remove all the dross that was in there. Biggest thing I noticed was the resolution preset just didn't work on Android, so I removed the code but left the API as is since it works on iOS.

You can find the fork here, feel free to use it or pull it into this project.

Incidentally, there is a FlutterFire plugin that does barcode scanning but there example doesn't work, at least not for me :-/

facundomedica commented 3 years ago

Hey @SoftWyer I didn't see your comment until now. I just finished a big refactor (had some spare time this weekend 😄 ) which brought everything to date. The new FlutterView, ML Kit instead of Firebase and null safety. It's a WIP, but usable imo. Super cool to see people still using it after so many years!