Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingPluginException No implementation found for method getPlatformVersion on Raspberry Pi board #166

Closed
sachin-lg opened this issue Mar 30, 2021 · 2 comments

Comments

@sachin-lg
Copy link

sachin-lg commented Mar 30, 2021

Issue Summary:-
We have created one sample plugin (getPlatformVersion) for Linux desktop platform and executed the same and it executed properly.
Next we want to execute the same plugin on raspberry pi board so for that we created build folder using “flutter build bundle” command and deployed the same raspberry pi board and executed the app using flutter embedder (flutter-pi) as mentioned in below command:
e.g. <./flutter-pi ./flutter_assets>
With this app is being launched but it is not able to access platform APIs through plugin and got below mentioned error:

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method getPlatformVersion on channel version)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
<asynchronous suspension>
#1      Version.platformVersion (package:version/version.dart:11:28)
<asynchronous suspension>
#2      _MyAppState.initPlatformState (package:version_example/main.dart:30:25)

Note:- We have already cross compiled flutter engine for raspberry pi board and able to execute sample app also.
Plugin Name :- version

Steps to Reproduce

  1. Run 'flutter create --template=plugin --platforms=linux version'
  2. After creating plugin, go to example directory under plugin directory and run 'flutter build bundle'
  3. deploy the build folder in raspberry pi board.
  4. Run app in the raspberry pi board using flutter embedder flutter-pi. Run below command:
    e.g. <./flutter-pi ./flutter_assets>

Expected results:- App should be launched and there should be platform (raspberry pi) version display in the app

Actual results:- App is launched but version is displayed as Unknown.

Result of 'flutter analyze' on app :- OK
Result of 'flutter analyze' on plugin :- OK

Output of running flutter doctor -v-

sachin@sachin-VirtualBox:~/Sachin/Flutter/plugins/version$ flutter doctor -v
[✓] Flutter (Channel master, 1.26.0-2.0.pre.275, on Linux, locale en_IN)
    • Flutter version 1.26.0-2.0.pre.275 at /home/sachin/Sachin/Flutter/flutter
    • Framework revision d9044a8a61 (3 months ago), 2021-01-09 04:04:04 -0500
    • Engine revision caf6a8191f
    • Dart version 2.12.0 (build 2.12.0-204.0.dev)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] VS Code (version 1.54.3)
    • VS Code at /usr/share/code
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Linux
    • Chrome (web)    • chrome • web-javascript • Google Chrome 87.0.4280.66

! Doctor found issues in 2 categories.

Query:-

  1. As we know that for native plugins, the supported platforms are android, ios, web, linux, macos, and windows. Can we support native plugins for any other embedded system (e.g. raspberry pi) also ? If we can, what is the procedure for the same ?
  2. If we have created bundle for raspberry pi board, how we can execute the same ? Is “kernel_blob.bin” enough to launch an app with plugin or some supporting files are also required ?

Thanks,

@ardera
Copy link
Owner

ardera commented Mar 30, 2021

1. As we know that for native plugins, the supported platforms are android, ios, web, linux, macos, and windows. Can we support native plugins for any other embedded system (e.g. raspberry pi) also ? If we can, what is the procedure for the same ?

Native plugins are supported, but they don't work the same way plugins for any other platform work. For normal platforms, the native code resides in the linux, android subdirectories of your flutter project. For flutter-pi, this native code is inside flutter-pi's src/plugins directory. I'm afraid if you want to write native C code, you'll probably have to do it inside flutter-pi. I'd look at maybe using dart:ffi if possible. I got the GPIO, serial and SPI plugins working purely using ffi without any native code.

2. If we have created bundle for raspberry pi board, how we can execute the same ? Is “kernel_blob.bin” enough to launch an app with plugin or some supporting files are also required ?

Since the native code lives inside flutter-pi, all you need is the assets bundle. (All the necessary code is inside kernel_blob.bin or app.so if using release mode)

@sachin-lg
Copy link
Author

  1. As we know that for native plugins, the supported platforms are android, ios, web, linux, macos, and windows. Can we support native plugins for any other embedded system (e.g. raspberry pi) also ? If we can, what is the procedure for the same ?

Native plugins are supported, but they don't work the same way plugins for any other platform work. For normal platforms, the native code resides in the linux, android subdirectories of your flutter project. For flutter-pi, this native code is inside flutter-pi's src/plugins directory. I'm afraid if you want to write native C code, you'll probably have to do it inside flutter-pi. I'd look at maybe using dart:ffi if possible. I got the GPIO, serial and SPI plugins working purely using ffi without any native code.

  1. If we have created bundle for raspberry pi board, how we can execute the same ? Is “kernel_blob.bin” enough to launch an app with plugin or some supporting files are also required ?

Since the native code lives inside flutter-pi, all you need is the assets bundle. (All the necessary code is inside kernel_blob.bin or app.so if using release mode)

Thanks for your response.
We will analyse the same as per your direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants