This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
fix when PhoneStateListener is not ready for use #387
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
fix when PhoneStateListener is not ready for use
probably because
Looper.myLooper()
returns null, but I can't find out how💡 Motivation and Context
java.lang.RuntimeException: Unable to create application package_here: java.lang.NullPointerException: Attempt to read from field 'android.os.MessageQueue android.os.Looper.mQueue' on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6465)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to read from field 'android.os.MessageQueue android.os.Looper.mQueue' on a null object reference
at android.os.Handler.(Handler.java:237)
at android.os.Handler.(Handler.java:142)
at android.telephony.PhoneStateListener.(PhoneStateListener.java:420)
at android.telephony.PhoneStateListener.(PhoneStateListener.java:385)
at io.sentry.android.core.PhoneStateBreadcrumbsIntegration$PhoneStateChangeListener.(PhoneStateBreadcrumbsIntegration.java:76)
at io.sentry.android.core.PhoneStateBreadcrumbsIntegration.register(PhoneStateBreadcrumbsIntegration.java:50)
at io.sentry.core.Hub.(Hub.java:38)
at io.sentry.core.Sentry.init(Sentry.java:144)
at io.sentry.core.Sentry.init(Sentry.java:92)
at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:59)
at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:44)
💚 How did you test it?
I didn't, could not reproduce it, but an NPE check doesn't hurt.
📝 Checklist
🔮 Next steps