mogol / flutter_secure_storage

A Flutter plugin to store data in secure storage
https://pub.dartlang.org/packages/flutter_secure_storage
BSD 3-Clause "New" or "Revised" License
1.09k stars 340 forks source link

Running xcodebuild produces fatal error: module 'flutter_secure_sotrage' not found #661

Closed AnthonyDadeWT closed 6 months ago

AnthonyDadeWT commented 6 months ago

This error seems to be related to what's faced in this post, however I have tried all of the solutions found there, and still cannot run xcodebuild.

We have added flutter_secure_storage to our project by using flutter pub add flutter_secure_storage and have the project defined as flutter_secure_storage: ^9.0.0 in the pubspec.yaml

I'm able to build my Flutter project using "Start Debugging" in VSCode, and using the Run button in Xcode, however if I try to build my project by running xcodebuild in the ios directory, I get the following error

....ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'flutter_secure_storage' not found @import flutter_secure_storage;

I am wanting to use this command so I can follow Flutter's documentation on sending integration tests to Firebase Test Labs

I've attached the error below.

flutter doctor -v shows no errors.

Let me know if I can supply more info

`ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'flutter_secure_storage' not found
@import flutter_secure_storage;
 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

CompileAssetCatalog /Users/anthonydade/REDACTED-REDACTED/REDACTED/ios/build/Release-prod-iphoneos/Release\ Prod.app /Users/anthonydade/REDACTED-REDACTED/REDACTED/ios/Runner/Assets.xcassets (in target 'Runner' from project 'Runner')
    cd /Users/anthonydade/REDACTED-REDACTED/REDACTED/ios
    /Applications/Xcode.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /Users/anthonydade/REDACTED/REDACTED/ios/build/Runner.build/Release-prod-iphoneos/Runner.build/assetcatalog_dependencies --output-partial-info-plist /Users/anthonydade/REDACTED/REDACTED/ios/build/Runner.build/Release-prod-iphoneos/Runner.build/assetcatalog_generated_info.plist --app-icon AppIcon --compress-pngs --enable-on-demand-resources YES --development-region en --target-device iphone --target-device ipad --minimum-deployment-target 16.0 --platform iphoneos --compile /Users/anthonydade/REDACTED/REDACTED/ios/build/Release-prod-iphoneos/Release\ Prod.app /Users/anthonydade/REDACTED/REDACTED/ios/Runner/Assets.xcassets

note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
`
AnthonyDadeWT commented 6 months ago

Turns out I needed to specify my build configuration, as we have multiple flavors setup.

xcodebuild build-for-testing -allowProvisioningUpdates \ -workspace Runner.xcworkspace \ -scheme dev \ -xcconfig Flutter/Release.xcconfig \ -configuration Debug-dev \ -derivedDataPath \ $output -sdk iphoneos