p-mazhnik / flutter-embedding

Contains examples of embedding Flutter in React apps.
https://p-mazhnik.github.io/flutter-embedding/expo/
23 stars 5 forks source link

native deps #16

Open joernroeder opened 5 days ago

joernroeder commented 5 days ago

this is great and got me pretty far on a poc I am working on. what about native dependencies the flutter app uses? usually those get auto linked on build, how would this work in an expo project? Any ideas or breadcrumbs?

p-mazhnik commented 5 days ago

flutter build ios-framework and flutter build aar commands will produce artifacts for the native dependencies as well, so they will become a part of the expo app automatically.

One exception if there is a shared cocoapods dependency on iOS (npm package depends on A and flutter package also depends on A). In this case, there will be A.xcframework produced by flutter build ios-framework and A.xcframework produced during the build phase for the expo iOS app, leading to build errors about duplicated framework.
Supporting such case will require an update to iOS scripts, more info can be found here: https://github.com/flutter/flutter/issues/130220 Basically, command flutter build ios-framework will be flutter build ios-framework --no-plugins, and plugins will be linked directly in Podfile using their podspecs, allowing the Cocoapods version management system to resolve common dependency automatically.

joernroeder commented 5 days ago

Interesting bc it sounds like it shouldn't be an issue then. I'll try and isolate my use case bc the example you provided works as expected, but when I tried to built an existing flutter app I already have I got

⚠️  ld: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
❌  Undefined symbols for architecture arm64
┌─ Symbol: _FIRConsentStatusDenied
└─ Referenced from: -[FLTFirebaseAnalyticsPlugin setConsent:withMethodCallResult:] in firebase_analytics[arm64][4](FLTFirebaseAnalyticsPlugin.o)

which indicated to me that something didn't get included properly.

joernroeder commented 1 day ago

adding this to the pubspec.yml of the expo example breaks it for me.

dependencies:
  firebase_core: 3.3.0 # <-- bundling this works fine
  firebase_analytics: 11.2.1 # <-- but adding this fails with the error above.