Reputation: 1263
I have flutter module added to the existing iOS app. Not all but few of the packages installed (via pubspec.yaml file) could not be found by the iOS app when compiled, and I'm getting 'Module not found' error in XCode. Those problematic packages are: razorpay_flutter, google_maps_flutter, webview_flutter, and url_launcher until now. Please have a look at screenshot below:
Same is the case with other 3 packages.
Steps to reproduce issue:
razorpay_flutter: ^1.1.3
in the pubspec.yaml file of the
flutter module flutter pub get
. The package will installOne more thing I observed after step 2, that there is some warning regarding issue for add to existing app:
Running "flutter pub get" in lib_smazing...
The plugin `razorpay_flutter` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment.
It may have undefined behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
I guess there is issue with the packages using platform channel/code when added to an existing app, but not sure whether its package-specific issue or a flutter issue with add-to-app.
Upvotes: 1
Views: 2969
Reputation: 384
There are multiple solutions available for any kind of library/module not found.
Solution # 1
flutter clean
flutter run again rebuild it from ios or vscode tool again.
if still problem
pod update
pod repo update
pod install
Solution# 2
delete build folder
delete pod.lock file
delete .syslinks folder
delete pods folder
change your directory in your terminal by
cd ios
pod install --repo-update OR pod repo update
pod install
flutter clean
flutter pub get
Solution# 3
please open Runner.xcworkspac with xcode because app will get local lib from pod install lib that installed. , but don't Runner.xcodeproj
Upvotes: 0
Reputation: 375
Rather trivial but realized my packages were not found because I opened and executed the wrong file in XCode - so open Runner.xcworkspace
and not Runner.xccodeproj
Upvotes: 1
Reputation: 1263
After few trials and error I found simply running pod install
on iOS project directory fixed the issue.
Upvotes: 2