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

iOS Rive initialization crash: init -> rive_text_ffi not found #432

Open
julianfalcionelli opened this issue Nov 14, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@julianfalcionelli
Copy link

julianfalcionelli commented Nov 14, 2024

Description

On iOS my rive animations are failing on initialization.

flutter: ----------------FIREBASE CRASHLYTICS----------------
flutter: Invalid argument(s): Failed to lookup symbol 'init': dlsym(RTLD_DEFAULT, init): symbol not found
flutter: 
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
#1      init (package:rive_common/src/rive_text_ffi.dart:497:16)
#2      init (package:rive_common/src/rive_text_ffi.dart)
#3      initFont (package:rive_common/src/rive_text_ffi.dart:814:3)
#4      Font.initialize (package:rive_common/rive_text.dart:463:7)
#5      RiveFile.initialize (package:rive/src/rive_file.dart:392:33)
#6      RiveFile._initTextAndImport (package:rive/src/rive_file.dart:414:13)
#7      RiveFile.asset (package:rive/src/rive_file.dart:444:12)
<asynchronous suspension>
#8      RiveAnimationState._configure (package:rive/src/widgets/rive_animation.dart:212:11)
<asynchronous suspension>
flutter: ----------------------------------------------------

On Android this is working as expected.

Rive version

rive: ^0.13.16

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.1.2 23B92 darwin-x64, locale en-AR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.93.1)
[✓] Connected device (4 available)
    ! Error: Browsing on the local area network for Julian’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

Rive File

get_started.riv.zip

Code

....

SizedBox(
            height: 400,
            child: RiveAnimation.asset(
              'assets/animations/rive/get_started.riv',
              artboard: 'Artboard',
              onInit: _onRiveInit,
            ),
          ),
....

  void _onRiveInit(Artboard artboard) {
    final controller =
        StateMachineController.fromArtboard(artboard, 'State Machine 1', onStateChange: (stateMachine, state) {
      LogHelper.d('State: $stateMachine -> $state');
      if (state == 'ExitState') {
        context.read<InitialBloc>().add(const InitialEvent.onGetStartedClicked());
      }
      if (state == 'Exit') {
        setState(() {
          _accessAccountOpacity = 0.0;
        });
      }
      if (state == 'KidsBlink') {
        setState(() {
          _accessAccountOpacity = 1.0;
        });
      }
    });
    if (controller == null) {
      LogHelper.e('State machine not found');
      return;
    }
    artboard.addController(controller);
    _controller = controller;
  }

@julianfalcionelli julianfalcionelli added the bug Something isn't working label Nov 14, 2024
@HayesGordon
Copy link
Contributor

Hi @julianfalcionelli, is this failing for you locally?

  • Which version of Flutter are you using?
  • What device is this reproducing on?

Can you try running flutter clean and rebuilding.

You can also try initializing Rive earlier in your app lifecycle. For example, at the start of main:

void main() {
  /// Initialize Rive's text, audio, and layout engines.
  /// This will automatically be called the first time a RiveFile is loaded if
  /// it has not been initialized. And does not need to be called.
  ///
  /// However, calling it early here makes the first
  /// visible Rive graphic load faster.
  unawaited(RiveFile.initialize());

...
  }

@julianfalcionelli
Copy link
Author

julianfalcionelli commented Nov 16, 2024

Hi @HayesGordon , thanks for your reply.

My Flutter version is:

Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2663184aa7 (9 weeks ago) • 2024-09-11 16:27:48 -0500
Engine • revision 36335019a8
Tools • Dart 3.5.3 • DevTools 2.37.3

We can reproduce this in all the iOS devices we have (I can get you the list of models and iOS versions next week since I have to contact QA), for me I am testing on an iPhone SE and emulator (iPhone 15 Pro - iOS 17).

I tried by cleaning everything and rebuilding (flutter clean).

I also tried calling the RiveFile.initialize() as you said but I got the same error when calling that function:

flutter: Invalid argument(s): Failed to lookup symbol 'init': dlsym(RTLD_DEFAULT, init): symbol not found
flutter: 
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
#1      init (package:rive_common/src/rive_text_ffi.dart:497:16)
#2      init (package:rive_common/src/rive_text_ffi.dart)
#3      initFont (package:rive_common/src/rive_text_ffi.dart:814:3)
#4      Font.initialize (package:rive_common/rive_text.dart:463:7)
#5      RiveFile.initialize (package:rive/src/rive_file.dart:392:33)
#6      LoadDependenciesGraphWidget.setupDependenciesGraph (package:earthrangers/ui/app/app.dart:190:20)
<asynchronous suspension>

Just got a replay from QA, the iOS devices they are using are:

  • iPhone 7: iOS 15
  • iPad pro 12.9" 3rd gen: iOS 18
  • iPad 6th gen iOS 17.5.1

@dimnocode
Copy link

dimnocode commented Nov 20, 2024

Hi,
Same issue here

Description

Simply calling RiveAnimation.asset('assets/animations/loading.riv')

No animation displayed and the following error appears in the logs.

Flutter clean and rebuild didn't help.

Works fine on Android

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'init': dlsym(RTLD_DEFAULT, init): symbol not found
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
#1      init (package:rive_common/src/rive_text_ffi.dart:497:16)
#2      init (package:rive_common/src/rive_text_ffi.dart)
#3      initFont (package:rive_common/src/rive_text_ffi.dart:814:3)
#4      Font.initialize (package:rive_common/rive_text.dart:463:7)
#5      RiveFile.initialize (package:rive/src/rive_file.dart:392:33)
#6      RiveFile._initTextAndImport (package:rive/src/rive_file.dart:414:13)
#7      RiveFile.asset (package:rive/src/rive_file.dart:444:12)
<asynchronous suspension>
#8      RiveAnimationState._configure (package:rive/src/widgets/rive_animation.dart:221:11)

Rive version

0.13.17

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.5, on macOS 14.7 23H124 darwin-x64, locale fr-BE)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Connected device (4 available)
[✓] Network resources

Tested devices

Iphone SE 2020 ios 16.6.1
Emulator iphone 16 Plus ios 18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants