ricnaaru / adv_camera

Advanced Camera for Flutter
BSD 3-Clause "New" or "Revised" License
54 stars 35 forks source link

Trying to use platform views with API 19, required API level is: 20. Can you lower the api level? #39

Closed thlstfs closed 3 years ago

thlstfs commented 3 years ago

Exception has occurred. PlatformException (PlatformException(error, java.lang.IllegalStateException: Trying to use platform views with API 19, required API level is: 20 at io.flutter.plugin.platform.PlatformViewsController$1.ensureValidAndroidVersion(PlatformViewsController.java:347) at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:175) at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104) at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59) at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:138) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) , null, null))

I think there is a solution. They released hybrid composition in Flutter 1.22, which just requires API level 19.

https://flutter.dev/docs/development/platform-integration/platform-views?tab=android-platform-views-kotlin-tab#hybrid-composition

I tried to lower api level but I couldn't do it. Can you lover min api level to 19?

ricnaaru commented 3 years ago

If I'm not mistaken, this is the least minSDKversion that I can make, that's why I don't use camera2 plugin from android yet. But if you really need to lower it more, feel free to fork and customize yours, thanks!