Search code examples
androidfirebaseflutterandroid-studioupgrade

How to upgrade http dependency in Android Studio


flutter pub get:

Because firebase_auth >=1.0.0 depends on firebase_auth_web ^1.0.0 which depends on http_parser ^4.0.0, firebase_auth >=1.0.0 require
s http_parser ^4.0.0.
And because http 0.12.2 depends on http_parser >=0.0.1 <4.0.0 and no versions of http match >0.12.2 <0.13.0, firebase_auth >=1.0.0 i
s incompatible with http ^0.12.2.
So, because p1 depends on both http ^0.12.2 and firebase_auth ^1.0.0, version solving failed.
Running "flutter pub get" in p1...
pub get failed (1; So, because p1 depends on both http ^0.12.2 and firebase_auth ^1.0.0, version solving failed.)

I just ran Flutter upgrade so my flutter and dart packages are up to date, and through SDK manager (in tools) I have android 10 and 11 installed along with the required sdk tools. Android studio has no pending updates for the dev channel. (5th March 2021) The firebase versions were included just yesterday.

dependencies:
  http: "^0.12.2"
  flutter:
    sdk: flutter


 
  cupertino_icons: ^1.0.0
  firebase_core: ^1.0.0
  firebase_auth: ^1.0.0
  firebase_database: ^6.1.0

I apologize if I am missing something right under my nose.

Edit: Yes, I totally missed it. I just had to look up http in pub.get then change the version. (latest: http: "^0.13.0") Please delete this if required.


Solution

  • Solution: I changed the version of http in dependencies (pubspec.yaml) from the older version to http: "^0.13.0" (latest as of 5th March 2021) (get the version from pub.dev and type in http, go to installing tab, and you'll find the version there).

    Then run flutter pub get, or whatever suits your needs.

    My current dependencies:

    dependencies:
      http: "^0.13.0"
      flutter:
        sdk: flutter
    
    
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^1.0.0
      firebase_core: ^1.0.0
      firebase_auth: ^1.0.0
      firebase_database: ^6.1.0
    

    If anyone else wants to share anything related, please do! Thank you.