0

I am building a Flutter Android App that uses Firebase Messaging. However, I get this error when compiling:

Error: Could not resolve the package 'firebase_messaging' in 
'package:firebase_messaging/firebase_messaging.dart'.

This are the relevant code excerpts:

Android\Build.Gradle:

buildscript {

    repositories {
        google()
    
    }

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
    google()
    jcenter()
}

}

App\Build.Gradle:

dependencies {
implementation 'com.google.firebase:firebase-messaging:20.2.4'

}

pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  shared_preferences: ^0.5.2
  firebase_core: ^0.2.5

1 Answer 1

0

You need to add firebase_messaging: ^7.0.0 to your pubspec.yaml

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.