在AndroidManifest.xml文件中添加:
在build.gradle(app)文件中添加:
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
}
将JSON文件拷贝到您的Flutter应用程序的根目录中。打开app/build.gradle文件并添加以下行:
apply plugin: 'com.google.gms.google-services'
dependencies {
// add the Firebase SDK for Google Cloud Messaging
implementation 'com.google.firebase:firebase-messaging:'
}
flutter upgrade
您可以使用以下命令检查并升级Firebase SDK版本:
dependencies {
implementation 'com.google.firebase:firebase-core:'
implementation 'com.google.firebase:firebase-messaging:'
}