Importing Firebase_Messaging makes build fail

332

Ok so after doing a bit more research I found out an answer. I added implementation 'com.google.firebase:firebase-messaging:19.0.1' to my app level gradle file and I get some warnings, but the app itself builds and runs.

Share:
332
Jacob Barcelona
Author by

Jacob Barcelona

Updated on December 12, 2022

Comments

  • Jacob Barcelona
    Jacob Barcelona over 1 year

    When I import firebase_messaging into my app(in pubspec.yaml and an import statement). My app fails to build. It was working perfectly before trying to import firebase_messaging. I checked the flutter directory to make sure it was the right version and everything. I'm kind of at a loss here.

    I tried updating android, and flutter.

    Pubspec.yaml

         dependencies:
      firebase_core: ^0.4.0+6
      firebase_analytics: ^3.0.2
      cloud_firestore: ^0.12.5+1
    
      firebase_auth: ^0.11.1+6
      google_sign_in: ^4.0.2
      rxdart: ^0.22.0
      css_colors: ^1.0.2
      flutter_auth_buttons: ^0.5.0
      firebase_messaging: ^5.1.2
    

    This is the error message

         Could not determine the dependencies of task 
    ':app:compileDebugJavaWithJavac'.
    > In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[18.0.
      0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
    
      Dependency failing: com.google.firebase:firebase-messaging:18.0.0 -> com.google.firebase:firebase-iid@[18.0.0], but fire
     base-iid version was 19.0.0.
    
     The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
     ifact with the issue.
      -- Project 'app' depends onto com.google.firebase:firebase- [email protected]
     -- Project 'app' depends on project 'firebase_messaging' which depends onto 
    com.google.firebase:[email protected].
      0
      -- Project 'app' depends onto com.google.firebase:[email protected]
      -- Project 'app' depends on project 'firebase_core' which depends onto 
    com.google.firebase:[email protected]
         -- Project 'app' depends onto com.google.firebase:firebase- 
       [email protected]
          -- Project 'app' depends on project 'firebase_analytics' which depends 
        onto com.google.firebase:[email protected].
      0
          -- Project 'app' depends onto com.google.android.gms:play-services- 
       [email protected]
      -- Project 'app' depends onto com.google.firebase:[email protected]
    
      For extended debugging info execute Gradle from the command line with 
    ./gradlew --info :app:assembleDebug to see the dep
      endency paths to the artifact. This error message came from the google- 
       services Gradle plugin, report issues at https://
      github.com/google/play-services-plugins and disable by adding 
    "googleServices { disableVersionCheck = false }" to your b
       uild.gradle file.
    
    * Try:
     Run with --stacktrace option to get the stack trace. Run with --info or -- 
    debug option to get more log output. Run with --scan to get full insights.
    
     * Get more help at https://help.gradle.org
    
    
     BUILD FAILED in 5s
    
  • DjH
    DjH over 4 years
    Thank you! This was driving me crazy. How have more people not run into this issue? I followed the documentation exactly, and this was definitely not in it. If anyone knows I would love to know, I'm pretty clueless with this stuff still.