Closed MarklBcm closed 1 week ago
Hey @MarklBcm! It seems like you have to initialize plugin by yourself before accessing its methods. I hope this related issues will help you:
1) https://github.com/firebase/flutterfire/issues/8204 2) https://github.com/flutter/flutter/issues/99155
Thanks to your help, I’ve learned something new. However, I still haven’t found a way to resolve the issue.
In my case, the issue also occurs in the release build.
I’d like to report an additional related issue:
When the app is closed using the physical back button on Android and then reopened, the same MissingPluginException occurs. • I temporarily resolved this issue by using exit(0), but I don’t think this is the best solution.
I’m experiencing an issue where the CrossplatformUiHelper.init(flutterPluginBinding.applicationContext) method fails, resulting in the MethodChannel not being initialized. This leads to the AdaptyUiFlutterPlugin throwing an exception
I modified the code as follows:
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
val iniailized = CrossplatformUiHelper.init(flutterPluginBinding.applicationContext)
if (!iniailized) {
Log.d("AdaptyUiFlutterPlugin", "CrossplatformUiHelper.init failed.")
}
channel = MethodChannel(flutterPluginBinding.binaryMessenger, CHANNEL_NAME).also { channel ->
channel.setMethodCallHandler(this)
}
channel?.let { channel -> callHandler.handleUiEvents(channel) }
}
It works well.
Could this change potentially cause any other issues?
@maru-eom In my experience, as long as you have properly initialized the plugin and the channels, there should not be any issues.
It seems like we have the answer to the initial question, so I am going to close the issue.
I am encountering an issue where the Adapty UI fails to display with the following error when the app is launched via an FCM push notification:
MissingPluginException(No implementation found for method create_view on channel flutter.adapty.com/adapty_ui)
This issue occurs under the following conditions:
Environment: • Adapty SDK Version: 2.10.1 • Adapty UI Version: 2.1.2 • Flutter Version: 3.22.2 • Platform: [Android] • OS Version: [Android 9, Android 10, Android 13(sometimes)]
Additional Context: This error does not occur on all devices, but seems to be specific to certain device models or OS versions. The issue might be related to the timing of Flutter plugin initialization when the app is launched via a notification.
Would appreciate any guidance or a potential fix for this issue. Thank you!