Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A NullPointerException occurs in the background when calling the getPackageName function related to FirebaseSession. #6222

Open
Dev-Czle opened this issue Aug 29, 2024 · 3 comments

Comments

@Dev-Czle
Copy link

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Koala | 2024.1.1 Patch 1
  • Firebase Component: Authentication, Firestore, FCM, Storage, Crashlytics, Config, FPM, Analytics, and Dynamic Links.
  • Component version: Bom 33.1.1

[REQUIRED] Step 3: Describe the problem

Hello,

We are currently using Firebase BoM version 33.1.1 and utilizing Authentication, Firestore, FCM, Storage, Crashlytics, Config, FPM, Analytics, and Dynamic Links.

Since the latest version, the following error has suddenly been reported to Crashlytics. Additionally, the error only occurs when the app is in the background.

I have searched for a solution, but the error name itself is too common, making it difficult to find relevant information. However, since we can see that the error occurs in the FirebaseSessions part, we are reaching out with this question. Below is the full error log.

Here's the logs

          Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
       at android.content.ComponentName.<init>(ComponentName.java:132)
       at android.content.Intent.<init>(Intent.java:8043)
       at com.google.firebase.sessions.SessionLifecycleServiceBinderImpl.bindToService(SessionLifecycleServiceBinder.kt:40)
       at com.google.firebase.sessions.SessionLifecycleClient.bindToService(SessionLifecycleClient.kt:107)
       at com.google.firebase.sessions.FirebaseSessions$1.invokeSuspend(FirebaseSessions.kt:54)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:30)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:45)
       at java.lang.Thread.run(Thread.java:1012)

image

@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@lehcar09
Copy link
Contributor

Hi @Dev-Czle, thank you for reaching out. I tried reproducing the issue, however, I wasn't able to encounter the error.

It's possible that the error you are seeing could be caused by a race condition or a behavioral change in Android 14.

A race condition occurs when two or more threads try to access the same resource at the same time. In this case, the FirebaseSessions component may be trying to access the application context while the application is in the background. If the application context is not available at that time, it could cause a NullPointerException.

Android 14 introduced behavioral changes regarding safer components and implicit intents that might contribute to this NullPointerException

Let me consult this with our engineers and get back to you.

@Dev-Czle
Copy link
Author

@lehcar09
i found it started Firebase-Messaging-topic IO Thread
image
i will help you what you need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants