Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter build failed 'UserAgent.h' file not found

Project cannot build or debug with firebase_crashlytics. In my mac I've updated to Flutter latest but the machine we are deploying the app have lower version (Flutter 1.9.1 hotfix-5). So I tried below things:

  • flutter pub cache repair
  • flutter clean
  • deleting Podfile.lock and ios/pod install

But no luck.

#import "UserAgent.h"
        ^~~~~~~~~~~~~
1 error generated.

Is there any solution without upgrading flutter for the time being?

like image 449
Blasanka Avatar asked Jan 04 '20 15:01

Blasanka


2 Answers

I was almost there, I think even if I clean the flutter and pod install will not clear everything. I just had to do below steps:

  • flutter clean
  • Delete Podfile.lock
  • cd ios
  • pod deintegrate // or you can do **cd ios/pod deintegrate** without above step
  • pod install

If this still didnt work. Please close .xcworkspace and podfile.lock then do last two step again and open newly generated .xcworkspace and Product -> build.

If not yet fixed please add a comment below (I have dealt lot of these problems).

Check here are created issues for this: issue 1 with firestore and issue 2 with crashlytics.

like image 198
Blasanka Avatar answered Oct 01 '22 08:10

Blasanka


As mentioned in the firestore issue ticket, fixing the version of the firebase core to 0.4.4 instead of using 0.4.4+2 fixed the issue:

dependency_overrides:
  firebase_core: 0.4.4

Add this along with your existing firebase_auth dependency.

like image 28
Shubham Chaudhary Avatar answered Oct 01 '22 07:10

Shubham Chaudhary