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

Not working in android #6

Closed
satvikreddy opened this issue Mar 18, 2024 · 3 comments
Closed

Not working in android #6

satvikreddy opened this issue Mar 18, 2024 · 3 comments

Comments

@satvikreddy
Copy link

satvikreddy commented Mar 18, 2024

Issue1: Download link is incorrect

When running
dart run opencv_dart:setup android arm64-v8a

It tries to download: https://github.com/rainyl/opencv_dart/releases/download/v0.6.5/libopencv_dart-android-x64.tar.gz
But this link does not exist

I think expected link is: https://github.com/rainyl/opencv_dart/releases/download/v0.6.5/libopencv_dart-android-arm64-v8a.tar.gz

Issue2: flutter run failing on android (both emulator and real device)
I hardcoded the correct link and tried flutter run, after running the opencv_dart:setup command. Getting the following error.
Am i missing some step? After adding package I only ran opencv_dart:setup command (android arm64-v8a variation)

Console error logs

E/flutter (15552): #2      loadNativeLibrary (package:opencv_dart/src/core/base.dart:35:31)
E/flutter (15552): #3      _bindings (package:opencv_dart/src/imgcodecs/imgcodecs.dart:14:32)
E/flutter (15552): #4      _bindings (package:opencv_dart/src/imgcodecs/imgcodecs.dart)
E/flutter (15552): #5      imread.<anonymous closure> (package:opencv_dart/src/imgcodecs/imgcodecs.dart:25:17)
E/flutter (15552): #6      using (package:ffi/src/arena.dart:124:31)
E/flutter (15552): #7      imread (package:opencv_dart/src/imgcodecs/imgcodecs.dart:24:10)
E/flutter (15552): #8      VisionService.test (package:sporty/services/vision_service.dart:5:20)
E/flutter (15552): #9      main (package:sporty/main.dart:9:17)
E/flutter (15552): #10     _runMain.<anonymous closure> (dart:ui/hooks.dart:301:23)
E/flutter (15552): #11     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
E/flutter (15552): #12     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
E/flutter (15552): 

Code:

void main() {
  final img = cv.imread("assets/test.jpg", flags: cv.IMREAD_COLOR);
  final gray = cv.Mat.empty();

  cv.cvtColor(img, gray, cv.COLOR_BGR2GRAY);
  print("${img.rows}, ${img.cols}");

  cv.imwrite("test_cvtcolor.jpg", gray);

  runApp(MyApp());
}

My development device:

  • Windows 11
  • Flutter 3.16.9
@rainyl
Copy link
Owner

rainyl commented Mar 19, 2024

look into IMPORTANT in README carefully, the correct command is

dart run opencv_dart:setup android --arch arm64-v8a

the default value of --arch(abbr: -a) depends on your desktop, i.e., most likely to be x64

@rainyl
Copy link
Owner

rainyl commented Mar 19, 2024

I have tested on android simulator and arm64 device, it worked fine.

image

@satvikreddy
Copy link
Author

Thanks for the clarification. Working now!

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