question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NullPointerException: Firebase Messaging component is not present

See original GitHub issue

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 2021.1.1 Patch 3
  • Firebase Component: Messaging
  • Component version: 21.0.1

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur?

java.lang.NullPointerException: Firebase Messaging component is not present

Relevant Code:

FirebaseMessaging.getInstance().getToken()
            .addOnCompleteListener(task -> {
              if (!task.isSuccessful()) {
                Log.w("FCM registration token", "Fetching FCM registration token failed", task.getException());
                return;
              }

              // Get new FCM registration token
              String token = task.getResult();

              // Log and toast
              Log.d("FCM registration token", token);
            });```

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
argzdevcommented, Sep 12, 2022

I’m glad you’re able to resolve your issue, @exaland. Thank you for posting the solution!

1reaction
exalandcommented, Sep 9, 2022

Resolved with

<service android:name="com.google.firebase.components.ComponentDiscoveryService" android:directBootAware="true" android:exported="false" >

<meta-data android:name="com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar" android:value="com.google.firebase.components.ComponentRegistrar" />

<meta-data android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar" android:value="com.google.firebase.components.ComponentRegistrar" /> </service>

thanks @argzdev for your Help 😃 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase messaging component is not present in android studio
My problem was that I had just shifted to Multi-Modular structure from a single app module and started facing this issue. I tried...
Read more >
Firebase Database component is not present. - B4X
java.lang.NullPointerException: Firebase Database component is not present. at com.google.android.gms.common.internal.Preconditions.
Read more >
NullPointerException in com.google.firebase.database
Getting this crash on crashlytics for a very few number of users. Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.
Read more >
com.google.firebase.components.componentdiscoveryservice
When I launch the app, it immediately crashes. Stating, App has crashed. java.lang.NullPointerException: Firebase Messaging component is not present.
Read more >
Dependencies of Firebase Android SDKs on Google Play ...
Google Play services not required ; In-App Messaging, com.google.firebase:firebase-inappmessaging:20.2.0 com.google.firebase:firebase-inappmessaging-ktx:20.2.0 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found