Please provide the following:
- SDK Version: 48
- Platforms(Android/iOS/web/all): Android, bare workflow. No problems on the iOS side of things
- Add the appropriate “Tag” based on what Expo library you have a question on.
I can’t get notifications to work on Android. I’ve followed all the info in the docs, and did the steps from beginning to end twice, yet still getting the same error message :
[Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Default FirebaseApp is not initialized in this process (bundle id for this project). Make sure to call FirebaseApp.initializeApp(Context) first.]
Things I’ve checked or tried so far from tickets that had similar-but-not-the-same error message
- I have a google-services file in the root of the project, and app.config.js refers to it under android.googleServicesFile. The google-services file only has one client object
- The API key is unrestricted, and in google-services client.api_key.current_key is the same as Google Cloud API Credentials console → Android key (auto-generated by Firebase)
- When calling getExpoPushTokenAsync, I tried passing a projectId since docs specify
In the bare workflow, you must provide a value which takes the shape @username/projectSlug, where username is the Expo account that the project is associated with, and projectSlug is your slug from app.json.
, this didn’t fix the problem - When googling
. Make sure to call FirebaseApp.initializeApp(Context) first.
I found plenty of native android tickets that mention adding lines to build.gradle files likeclasspath 'com.google.gms:google-services:4.3.2'
but so far none of these proposed solutions worked
Is there anything specific to bare projects and expo-notifications that I should be looking into? Any clue would be greatly appreciated, thanks
Edit : I ran adb logcat to see if I can get any more info and got this : W FirebaseApp: Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.