-
Notifications
You must be signed in to change notification settings - Fork 270
Description
Description
Hi,
I am having trouble setting up push-notifications for android.
I would suspect that the extra step I add to take (in addition to your documentation) to add the com.google.gms.google-services plugin is what is causing the error.
Regards,
Categories
- Analytics
- API (REST)
- API (GraphQL)
- Auth
- Authenticator
- DataStore
- Notifications (Push)
- Storage
Steps to Reproduce
I first encountered an issue at this stage :

Simply adding the line apply plugin: 'com.google.gms.google-services' to my app/build.gradle created the following error :
Where:
Build file '/Users/clem/Documents/Morp/morp_alpha/android/app/build.gradle' line: 101What went wrong:
A problem occurred evaluating project ':app'.Plugin with id 'com.google.gms.google-services' not found.
I finally managed to compile the app by :
- Adding this code snippet to my android/build.gradle file :
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.4.2'
}
}
- Adding the google-services.json file provided by firebase in my android/app folder.
However, I now get the following runtime error when running Amplify.configure(amplifyconfig):
E/flutter ( 5262): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PushNotificationException { E/flutter ( 5262): "message": "Error occurred awaiting for device token.", E/flutter ( 5262): "recoverySuggestion": "Review the underlying exception.", E/flutter ( 5262): "underlyingException": "PlatformException(java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.morp.morp_alpha. Make sure to call FirebaseApp.initializeApp(Context) first., IllegalStateException, Cause: null, Stacktrace: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.morphit.morphit_alpha. Make sure to call FirebaseApp.initializeApp(Context) first.\n\tat com.google.firebase.FirebaseApp.getInstance(FirebaseApp.java:179)\n\tat com.google.firebase.messaging.FirebaseMessaging.getInstance(FirebaseMessaging.java:137)
Screenshots
No response
Platforms
- iOS
- Android
- Web
- macOS
- Windows
- Linux
Flutter Version
3.22.2
Amplify Flutter Version
2.2.0
Deployment Method
AWS CDK
Schema
No response