rive-app/rive-flutter

Unable to use Rive in widget tests

WilliamKarolDiCioccio opened this issue · 2 comments

Description

When running my widget tests those making use of rive-flutter fail with the following console output:

00:01 +0 -1: loading C:/Users/***/Desktop/open_local_ui/app/test/frontend/rive_animation_test.dart [E]
  Failed to load "C:/Users/***/Desktop/open_local_ui/app/test/frontend/rive_animation_test.dart":
  Invalid argument(s): Failed to load dynamic library 'rive_common_plugin.dll': The specified module could not be found.
   (error code: 126)
  dart:ffi                                                   new DynamicLibrary.open
  package:rive_common/src/dynamic_library_helper.dart 47:29  RiveDynamicLibraryHelper.open
  package:rive_common/src/dynamic_library_helper.dart 14:43  RiveDynamicLibraryHelper.nativeLib
  package:rive_common/src/dynamic_library_helper.dart        RiveDynamicLibraryHelper.nativeLib
  package:rive_common/src/rive_text_ffi.dart 10:59           _nativeLib
  package:rive_common/src/rive_text_ffi.dart 491:5           init
  package:rive_common/src/rive_text_ffi.dart                 init
  package:rive_common/src/rive_text_ffi.dart 808:3           initFont
  package:rive_common/rive_text.dart 461:7                   Font.initialize
  package:rive/src/rive_file.dart 392:33                     RiveFile.initialize
  test\frontend\rive_animation_test.dart 9:18                main


To run this test again: C:\tools\flutter\bin\cache\dart-sdk\bin\dart.exe test C:/Users/***/Desktop/open_local_ui/app/test/frontend/rive_animation_test.dart -p vm --plain-name "loading C:/Users/***/Desktop/open_local_ui/app/test/frontend/rive_animation_test.dart"
00:01 +0 -1: Some tests failed.

The problem seems to be related to the rive_common_plugin DLL not being found during test runs despite being correclty built and present in the build directories (both debug and release). The issue does not show up during normal flutter runs both on Linux and Windows. I'm running the latest rive release an the latest stable flutter release.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Try to write any widget unit test around Rive

Expected behavior

The test should succeed or fail without any rive-flutter related errors but rather my own errors.

Device & Versions (please complete the following information)

  • Device: PC
  • OS: Windows 11 Pro
  • Flutter Version:
Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 80c2e84975 (4 weeks ago) • 2024-07-30 23:06:49 +0700
Engine • revision b8800d88be
Tools • Dart 3.5.0 • DevTools 2.37.2

We're working on resolving this with the next major version that will change how the underlying native libraries are built. Closing this issue as a duplicate of #354

More information there.

Thanks. Did't find that by Googling