Flutter iOS archive release getting 'xx plugin.h' file not found error in Xcode
Solution 1
This is hardly an ideal answer, but the way I solved it was to create a new project with the same name and then bit by bit copy all of the pieces over from the old app, testing that it builds in Xcode all along the way. By the very end it still built and I was able to make the archive.
Apparently there is something about new Flutter projects that don't contain whatever was causing the error before.
Solution 2
My solution was to clean the repositories with CMD + Shift + K, then generate a clean flutter and then get flutter packages.
This was solved and generated the .ipa satisfactorily.
Solution 3
Restarted Xcode and reopened my project by .workspace (not .project) file. Everything started to archive again.
Comments
-
Suragch over 1 year
Following the steps at Preparing an iOS App for Release, I got to Create Build Archive and the following command ran successfully:
flutter build ios
However, when I opened the project Runner in Xcode to create the archive, I get an error in the
GeneratePluginRegistrant.m
file:'package_info/PackageInfoPlugin.h' file not found
I thought that maybe it was the fault of the plugin so I removed that plugin from my project. But then I got an error on the next one:
'path_provider/PathProviderPlugin.h' file not found
Here are my flutter doctor results:
[✓] Flutter (Channel beta, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [✓] iOS toolchain - develop for iOS devices (Xcode 10.1) [✓] Android Studio (version 3.3) [✓] VS Code (version 1.32.0) [✓] Connected device (2 available)
What do I need to do to resolve this problem?
Update 1
I'm pretty sure I checked the Swift option when I created the project, but I'm not using any custom Swift code, so that isn't a necessity.
These GitHub issues look the same: here and here. However, running the following command (as suggested in the comments) didn't change the error message:
flutter build ios --release --no-codesign
Update 2
I started a new Flutter project (with Swift support) and added the following dependencies:
dependencies: flutter: sdk: flutter path_provider: ^0.4.1 sqflite: ^1.0.0 package_info: ^0.4.0+2 webview_flutter: ^0.3.4 url_launcher: ^5.0.2
But there were no errors and I was able to run the Archive.
Now I don't know where to look for the error in my original app.
-
Suragch about 4 yearsI saw a comment somewhere about running
flutter create
to fix missing files. I don't know if that would apply here, but it might help. -
Suragch over 3 years@genericUser, I'm talking about
flutter create .
notflutter clean
. -
Afandi Yusuf almost 3 yearsHappened to me either, 2 hours of googling and try different solution still didn't work, until I got my gut to follow your solution (Creating new project). And yeah, the error is gone, I think that new project had something that flutter upgrade didn't have. Thanks @suragch
-
Suragch almost 3 yearsIf I were to do this again I might just try deleting the
ios
folder and runningflutter create .
to rebuild it before completely creating a new project, but it's really not that hard to create a new project too.