rive-app / rive-flutter

Flutter runtime for Rive
https://rive.app
MIT License
1.2k stars 188 forks source link

Flutter tests failing since version 0.13.2 #387

Closed MarcinusX closed 3 weeks ago

MarcinusX commented 4 months ago

Description

I have tried to update Rive package to either 0.13.2 or 0.13.4 and everything seems to be fine but when I run tests I'm receiving a following error for any widget test that is showing a Rive file:

══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following ArgumentError was thrown running a test:
Invalid argument(s): Failed to lookup symbol 'init': dlsym(RTLD_DEFAULT, init): symbol not found

When the exception was thrown, this was the stack:
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
#1      init (package:rive_common/src/rive_text_ffi.dart:527:15)
#2      init (package:rive_common/src/rive_text_ffi.dart)
#3      initFont (package:rive_common/src/rive_text_ffi.dart:836:3)
#4      Font.initialize (package:rive_common/rive_text.dart:477:7)
#5      RiveFile.initializeText (package:rive/src/rive_file.dart:365:33)
#6      main.<anonymous closure>.<anonymous closure> (...)
#7      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:183:29)
<asynchronous suspension>
#8      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1017:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)

When I downgrade to 0.13.1, everything is fine.

Device & Versions (please complete the following information)

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.19.6, on macOS 14.3.1 23D60 darwin-arm64, locale en-PL)
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.0.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
      /Users/marcinszalek/flutter. Consider adding /Users/marcinszalek/flutter/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (3 available)
    ! Error: Browsing on the local area network for Marcin’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this
      Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

Thank you in advance!

vilorel commented 4 months ago

The same thing happens to me (same output as yours too). The only difference is that none of the versions (0.13.0 - 0.13.4) work for iOS. Android installations don't have a problem.

HayesGordon commented 4 months ago

Apologies for this. Our underlying C++ engine has added new features that every Rive animation now depends on. Previously this would have only been an issue if your animation made use of Rive Text.

For additional context and instructions on how to solve this issue, see here: https://github.com/rive-app/rive-flutter/issues/354#issuecomment-2084677570

The summary is that you will need to generate certain libraries the runtime depends on, as these need to be provided externally for Flutter tests.

We'll need to consider a better long-term solution

HayesGordon commented 3 weeks ago

Closing this as a duplicate of https://github.com/rive-app/rive-flutter/issues/354