-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Reproducible with the example from FFI plugin (flutter create -t package_ffi ffi_x) on iOS device
Exception after hot restart with the example application
Invalid argument(s): Couldn't resolve native function 'sum' in
'package:ffi_x/ffi_x_bindings_generated.dart' : Failed to load dynamic library
'ffi_x1.framework/ffi_x1': Failed to load dynamic library 'ffi_x1.framework/ffi_x1':
dlopen(ffi_x1.framework/ffi_x1, 0x0001): tried:
'/Library/Developer/CoreSimulator/Volumes/iOS_20E247/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS
16.4.simruntime/Contents/Resources/RuntimeRootffi_x1.framework/ffi_x1' (no such file),
'/Library/Developer/CoreSimulator/Volumes/iOS_20E247/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS
16.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/ffi_x1.framework/ffi_x1' (no such
file), '/usr/lib/swift/ffi_x1.framework/ffi_x1' (no such file, not in dyld cache),
The problem seems to be multiple assets paths generated during dry run in _assetTargetLocations:
flutter/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart
Lines 162 to 169 in 02a6c91
| Map<AssetImpl, KernelAsset> _assetTargetLocations( | |
| List<AssetImpl> nativeAssets) { | |
| final Set<String> alreadyTakenNames = <String>{}; | |
| return <AssetImpl, KernelAsset>{ | |
| for (final AssetImpl asset in nativeAssets) | |
| asset: _targetLocationIOS(asset, alreadyTakenNames), | |
| }; | |
| } |
Here the code generates different path for each architecture even if assetId is same. Probably requires similar treatment as https://github.com/flutter/flutter/pull/144688/files.
Fixing this fixes the hot reload, though TBH I don't know why during hot reaload the path from second native asset is used. Still, they are lipeod in reality so behavior of the function as it is now seems wrong and it shouldn't produce three different paths for same asssetId.
/cc @dcharkes